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 / Get Virtual Button State problem

Author
Message
tschwarz
19
Years of Service
User Offline
Joined: 13th Feb 2005
Location: 127.0.0.1
Posted: 17th Nov 2011 05:56


Upon loading, the code prints GetVirtualButtonState = 0
When holding down the Virtual Button the state changes to 1 and prints \\\"Button Held\\\" but the animation does not play.
Releasing the Virtual Button the code prints GetVirtualButtonState = 0 The \\\"Button Held\\\" goes away and then the animation plays.

I assumed that if GetVirtualButtonState = 1 it should display \\\"Button Held\\\" and play the animation or am I missing something.
I didn\\\'t find anything in the doc\\\'s or the forum about this.
Any Thoughts?

Shall we play a game?” - Joshua
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th Nov 2011 10:16 Edited at: 17th Nov 2011 10:17
You are already calling getVirtualButtonState so it will reset the value maybe?

Try this:


Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 17th Nov 2011 11:16
I think the issue is that when you hold the button down, you are constantly calling 'PlaySprite'. This will not work as when you call 'PlaySprite' it plays it from the beginning. Constantly calling it, would make it appear to not be working (when in fact its just starting again every loop)...

Try this...



And then you would probably want to create another if statment for when the button is released, to stop the sprite from playing...
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th Nov 2011 11:26 Edited at: 17th Nov 2011 11:28
Good thought there @Funnell7, you could be right but the sprite should continue playing after he has released the button... I guess it depends how many animation frames there are as to how visible the result would be?

EDIT: Also he's not using loop so it should just stop after the animation I think on the last frame?

I tend to set animation frames manually, it's far more easy to keep full control (for me anyway)

Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 17th Nov 2011 11:40 Edited at: 17th Nov 2011 11:42
The OP said that when they release the button, the animation plays

EDIT: regarding the looping... I believe the default is for it to loop...
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th Nov 2011 11:46
Quote: "The OP said that when they release the button, the animation plays"

So it does, I misread that

Quote: "regarding the looping... I believe the default is for it to loop..."

Correct again!
Quote: "iLoop - the looping mode of the sprite, 0 equals do not loop, 1 equals loop forever (optional, default 1)."


I thought he was saying it wasn't playing at all, my mistake.

tschwarz
19
Years of Service
User Offline
Joined: 13th Feb 2005
Location: 127.0.0.1
Posted: 17th Nov 2011 19:18
Makes perfect sense that the animation would be starting from the beginning each loop appearing not to work. It works and lesson learned Funnell7, in fact an example does show it and I over looked it.
thank you both for your time.

Shall we play a game?” - Joshua
Meows
12
Years of Service
User Offline
Joined: 12th Oct 2011
Location: Totally over the Rainbow
Posted: 25th Jan 2012 05:28
tschwarz,
Signs V got corrupted and The web site is not valad. where can i get it again. I had the registered version.

Life is a short trip to another world

Login to post a reply

Server time is: 2024-05-04 21:25:54
Your offset time is: 2024-05-04 21:25:54