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.

Newcomers AppGameKit Corner / Problem with animation with buttons

Years of Service
User Offline
Joined: 17th Aug 2010
Posted: 5th Jan 2019 15:21
Sorry for my questions but i have problems with buttons+keys +animation

With this buttons the character stay in same frame and not animated! What i do wrong?
DBPro Master
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Jan 2019 18:13
The problem is with your first IF statement. Not sure what those key numbers go to, other than 37 and 39 being arrow keys. But just to simplify, I'll call them A, B, C, D, respectfully. The logic is hard to follow of what you're trying to do with those buttons. The first OR statement should probably be in parenthesis itself.

If ((A = 0 OR B = 0) AND C = 0) OR D = 0

So C has to be 0 along with either A or B (but not both) to trigger that IF statement. Or D has to be 0. My guess is that this statement is always triggering true and thus your sprite is never played. What is this IF statement suppose to do? Because I'm certain the error is in the logic of that line.

Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Years of Service
User Offline
Joined: 9th Jan 2018
Posted: 8th Jan 2019 23:00
Yeah, the 'OR' parts in the if statement should all be 'and' instead, then it should work.

I'm not sure I would put this in a 'if.... else' statement though, but would use separate if statements and maybe use an 'is_animating' or 'is_moving' flag system, but maybe others can chime in.

Login to post a reply

Server time is: 2023-12-10 00:33:55
Your offset time is: 2023-12-10 00:33:55