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! / Help Needed Please! Anyone?

Author
Message
SuperCort2003
20
Years of Service
User Offline
Joined: 7th Jul 2003
Location: Metropolis
Posted: 17th Jul 2003 04:03
[b]HEy everyone. I've been posting all day and I just need a quick answer. It's with my sprite. I'm using DarkBasic Classic and I'm using multiple images. The problem is my sprite works fine going left but when he goes right, he keeps turning left and right while walking backwards right. Any help with my code is appreciated. Thanks again. Hey plus I know it might be a simple answer but I just can't figure it out because I'm looking at all these tutorials and it just doesn't show me. Please help!
SuperCort2003@aol.com
SuperCort2003
20
Years of Service
User Offline
Joined: 7th Jul 2003
Location: Metropolis
Posted: 17th Jul 2003 05:44
[/b]Hey it's working! Only one problem. His legs won't move right. If you look at my code you see what I'm talking about. Images R-Walk to R-Walk6 is not being shown when the sprite goes right. Help Please. I'm a newbie and I learn from example so could you just please reply. Thanks Everyone.

Later
SuperCort2003[b][/b]
TeePee
20
Years of Service
User Offline
Joined: 18th Apr 2003
Location: Australia
Posted: 18th Jul 2003 11:35
ok ive had a look at your code and what i see is that the error is in this bit


you see when ever you press right, 8 is being added to herostance. so if herostance was 1 and you pressed right, herostance would become 8. if it was pressed again herostance would become 16 and therefore because thats greater then 14 it would then become 8 again, so herostance will always be 8 when your walking right. now im no expert but the way i would fix it would be to add another variable called 'herodir' as in hero direction. then you change the above code so that the line:

herostance=herostance+8

becomes

herostance=herostance-1

you could then use herodir to determine which way the hero is facing. if herodir does not equal what it was during the last do loop, then you add 8 or subtract 8 for herostance. so the finished code becomes...



i havent tested it or anything but i hope it helps, buddy happy coding!

SuperCort2003
20
Years of Service
User Offline
Joined: 7th Jul 2003
Location: Metropolis
Posted: 18th Jul 2003 17:39
I thank you for your reply! But actually the code snippet didn't work! Darn! It said it had an unrecognized parameter at this part:
else if leftkey()=1 and herodir = 2
But thanks for replying!

SuperCort2003

Login to post a reply

Server time is: 2024-02-24 21:42:24
Your offset time is: 2024-02-24 21:42:24