• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.
  • The forums have been upgraded with support for dark mode. By default it will follow the setting on your system/browser. You may override it by scrolling to the end of the page and clicking the gears icon.

phaser.js dynamic frame width

Joined
May 27, 2008
Messages
3,629 (0.58/day)
System Name Ultra 64
Processor NEC VR4300 (MIPS R4300i)
Motherboard proprietary design
Cooling Fanless aircooled
Memory 4.5MB 250 MHz RDRAM
Video Card(s) 62.5 MHz Reality Coprocessor
Storage 32 - 512 Mbit ROM Cartridge
Display(s) 720x576
Case Clear Blue Funtastic
Audio Device(s) 16-bit CD quality
Power Supply proprietary design
Mouse N64 mouse for use with N64DD
Keyboard N64 keyboard for use with N64DD
Hi all

I'm making a little project with phaser.js to make a little game.

I have a sprite sheet of a character that walks and has an idle animation. I'm now adding the ability to jump. However i have a frame of 80 px wide. The problem is the jump sprites are wider. Mid jump the character is almost horizontal which is about 100px wide however the start and ends of the animation the character is stood up so the normal 80 px wide. This means at the start and end of the animation the character is about 20px wider than he needs to be during the jump animation. This won't be a problem unless he collides with something at the start or end of the animation, the collision will happen before the character actually hits the object.

So my question how would you handle this? Would you change the sprites to make them more of a similar width (Not preferred) or can you change the width of each frame during the animation to compensate for the middle of the jump where the character is wider than when standing.

Ta Stephen.
 
This can be accomplished with a texture atlas. At work currently but will post more info when i get home if people are interested.
 
Back
Top