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! / My sprite isn't animated!

Author
Message
BahamutZERO
21
Years of Service
User Offline
Joined: 16th Mar 2003
Location: United Kingdom
Posted: 10th May 2003 02:41
I am teaching myself how to make a platformer, cause I can't find and tutorials anywhere, and I thought I'd start by making a 2D character walk sideways. I wrote the program and then tested it but the sprite isn't animated when I used different images to display the hero sprite. The only reason I can think of is that it changes too fast. Am I right? Please help me.

*I know some of my work may seem silly at some points but I try to make it easy for me to work with.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th May 2003 03:24
Try something a little more like this (untested code).



I've added a new variable called heroface that is 0 when facing left, and 1 when facing right. You may want to work out a way to slow down the animation though - changing image every frame is probably a bit much
BahamutZERO
21
Years of Service
User Offline
Joined: 16th Mar 2003
Location: United Kingdom
Posted: 10th May 2003 16:19
I know how to do that. I was going to add after I got this working right. I found a way to make it animated but I am worried that it might slow other sprites down when I get round to adding them.

IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th May 2003 22:09
No, there's a *big* difference between your code and mine.

You are showing a frame of the image, doing a wait, showing the next frame, doing a wait...

You'll not be able to animate or move anything else at the same time in this way.

To see what I mean, take this slightly modified version of my code:


Now my program is animating one sprite when the left/right keys are pressed, and two others are animating non-stop.

Login to post a reply

Server time is: 2024-04-26 14:52:44
Your offset time is: 2024-04-26 14:52:44