mirror of
https://github.com/luksamuk/engine-psx.git
synced 2025-04-28 13:28:02 +03:00
Add parallax auto movement
This commit is contained in:
parent
bb0624ad35
commit
686ab38515
5 changed files with 23 additions and 4 deletions
|
@ -40,6 +40,7 @@ class ParallaxPart:
|
|||
class ParallaxStrip:
|
||||
single: bool = False
|
||||
scrollx: float = 0
|
||||
speedx: float = 0
|
||||
y0: int = 0
|
||||
parts: [ParallaxPart] = field(default_factory=list)
|
||||
|
||||
|
@ -47,6 +48,7 @@ class ParallaxStrip:
|
|||
f.write(c_ubyte(len(self.parts)))
|
||||
f.write(c_ubyte(int(self.single)))
|
||||
f.write(c_int(tofixed12(self.scrollx)))
|
||||
f.write(c_int(tofixed12(self.speedx)))
|
||||
f.write(c_short(self.y0))
|
||||
for p in self.parts:
|
||||
p.write_to(f)
|
||||
|
@ -69,6 +71,7 @@ def parse(data) -> Parallax:
|
|||
strip = ParallaxStrip()
|
||||
strip.single = strip_data.get("single", False)
|
||||
strip.scrollx = strip_data.get("scrollx", 0)
|
||||
strip.speedx = strip_data.get("speedx", 0)
|
||||
strip.y0 = strip_data.get("y0")
|
||||
height = strip_data.get("height") # Reserved
|
||||
parts = strip_data.get("parts")
|
||||
|
|
|
@ -12,6 +12,7 @@ struct ParallaxStrip {
|
|||
u8 num_parts;
|
||||
u8 is_single;
|
||||
be s32 scrollx;
|
||||
be s32 speedx;
|
||||
be s16 y0;
|
||||
ParallaxPart parts[num_parts];
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue