Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / 2d Animation Problem

Author
Message
speede
13
Years of Service
User Offline
Joined: 22nd Oct 2010
Location: UK
Posted: 22nd Oct 2010 19:22
Hi there,

I am very new to the forum, as I have just started a Game Development course in college. I am trying to get a 2d character to move, but so far it only walks down the screen and moves to the sides without moving legs! I have downloaded a walk cycle which containts 16 steps in it. Could anyone tell me whether I can use one image or do I need to create 4 seperate images?



Regards,
SPEED-E

Attachments

Login to view attachments
Pilz X Schizo
16
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Massachusetts, USA
Posted: 23rd Oct 2010 09:26
Theres a few things I noticed right away. 1st thing is you say there are 16 frames for your animation but you are dividing it into 24 segments (6 x 4 = 24). 2nd thing is the only time you play your sprite is when you are pressing down. Since I don't use sprites this advice may not be completly correct but it should get you going in the right direction. For each direction you should set your sprite frame to the first frame of that directions animation then play the sprite using that directions frame range and then move the sprite.

example:


The last thing was why are you deleting 10 images/sprites at the end when you have only created 1?

Hope this helps you. Good luck.

speede
13
Years of Service
User Offline
Joined: 22nd Oct 2010
Location: UK
Posted: 26th Oct 2010 02:55
Thank you for such a quick reply!
I was away from home, had a busy week so I will look into it just now. I realised that it was 24 frames after I posted it, but as it was my 1st thread I couldn't edit it I didn't know how to call different frames in the image, that is a good lesson!

I already tried your tip, if I set the frame in the if statement it doesn't play it (instead it just stops on the frame set). Without setting the frame it moves throught all the frames and then it finally plays the right ones. Do you know what might be the problem?
Pilz X Schizo
16
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Massachusetts, USA
Posted: 27th Oct 2010 10:21
Like I said I don't use sprites so it might of been a little off but a quick look back over it and I see the problem. It is never getting a chance to play because the frame is allways set back to the begining (my bad, sorry). Maybe replace the set frame line with another if statment that checks the range for that direction and if it isnt in that range then set it to the first frame otherwise it will just play.

ex: if(dbSpriteFrame(1)<1 || dbSpriteFrame(1)>6){ dbSetSpriteFrame(1, 1); }

That may work though I may still be off. I know i've seen this subject discussed around here befor but can't seem to bring it up on a search.

speede
13
Years of Service
User Offline
Joined: 22nd Oct 2010
Location: UK
Posted: 29th Oct 2010 17:43
That helped me!

Thank you so much for your help

Login to post a reply

Server time is: 2024-02-22 03:27:28
Your offset time is: 2024-02-22 03:27:28