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.

AppGameKit Classic Chat / New user question

Author
Message
Kozax
9
Years of Service
User Offline
Joined: 28th Jul 2015
Location: London, UK
Posted: 28th Jul 2015 16:57
Hello!

I was a Contsruct 2 user and I wanted to try something different
I am new to AGK2 and currently I am facing a problem and I hope someone can help me .

I am trying to setup multiple animations for one sprite
and switch between those sprites with mouse click.
So I did:



Thank you for your time!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Jul 2015 19:26 Edited at: 28th Jul 2015 19:27
Welcome

Does Player have a value?
If not, use this syntax:

Player = CreateSprite(0)

You are using getPointerState(). This returns a 0 all the time the pointer is not clicked, and 1 while it is. So in your code you are constantly resetting the animation to frame 1 or frame 5, and the animation never gets any further.

You will need to use GetPointerPressed() or GetPointerReleased() to capture the change in just one frame, and allow the animation to progress.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Kozax
9
Years of Service
User Offline
Joined: 28th Jul 2015
Location: London, UK
Posted: 28th Jul 2015 21:04 Edited at: 29th Jul 2015 13:16
Hello again,

Thank you for your quick response!
When I put the code with pressed and released in the game loop it worked!

Cheers
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Jul 2015 22:57
no problem, glad it worked.

It's a common first mistake, I'm sure I did it the first time around too.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Login to post a reply

Server time is: 2024-11-25 19:34:18
Your offset time is: 2024-11-25 19:34:18