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.

DarkBASIC Professional Discussion / Cannot Read Other Sprite Movements

Author
Message
SpoonAndFork
14
Years of Service
User Offline
Joined: 9th Oct 2011
Location:
Posted: 9th Oct 2011 09:59
Yosh Everyone! Good Day

This is my first time posting in a forum cause i feel shy asking.
Me and my partner is creating a simple game. And we just started using DBPro. We are going to move the sprite using the arrow keys. The problem is it doesn't execute the other movements except for the last movement we added. Example, we are going to use the rightkey() and it will move to the right showing the sprite which moves to the right. But when we try to add another movement it will not execute all other movements.

here is the sample code we made:



In this code, only the Jump Movement will be seen when the program is compiled. Thanks in advance for any help God Bless!
noobnerd
15
Years of Service
User Offline
Joined: 30th Nov 2010
Location:
Posted: 9th Oct 2011 16:17
Change the playeranim to this:



this is because of the if else logic you use.

take the example ( in your code ) that you are walking right. ( rightkey ) then anim will be 1
now we come to the playeranim part. at first imgnum will indeed become 2 but then as anim is 0 all the following will be false. that means that the code after else will be executed resulting in a imgnum of 1.

Login to post a reply

Server time is: 2026-07-10 23:33:42
Your offset time is: 2026-07-10 23:33:42