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 / Countdown when button pressed

Author
Message
erocore
8
Years of Service
User Offline
Joined: 18th Jan 2016
Location:
Posted: 18th Jan 2016 20:24 Edited at: 18th Jan 2016 21:47
Hey,

I hope this question (actually 2) isn't stupid but here goes:

I am trying to make a button that when clicked on launches a countdown, so I am doing something like



I suppose it works but it only shows for the milisecond that I am clicking - how can I change that?


The other problem is that lots of my buttons/sprites etc are activated with a single click instead of multiple. E.g. if I have menu button 1 and it is supposed to launch menu 2, one click will already activate the button in menu 2 that is on the same position. How could I prevent that?


Thanks for the help!
erocore
8
Years of Service
User Offline
Joined: 18th Jan 2016
Location:
Posted: 18th Jan 2016 22:12
Somehow this forum is really weird for me, I can't see my original post anymore, so here goes my two questions again:

I want to start a countdown timer after a button has been pressed. So I did this:

But this will only show during the milisecond that I am clicking. How can I make it be permanently displayed?

Also, clicks somehow register multiple times. E.g. when I click on a Menu Button, it also counts as a click for the submenu button. How can I fix this?

Thank you!
BatVink
Moderator
20
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Jan 2016 13:16
Welcome

Quote: "Somehow this forum is really weird for me, I can't see my original post anymore, "

All new users are on post moderation for a short while. It doesn't last long.

GetPointerReleased() is only true for one cycle, then it resets.
You need to set a variable when GetPointerReleased() is true. Then you can use the variable to keep your countdown going.

Quote: "E.g. if I have menu button 1 and it is supposed to launch menu 2, one click will already activate the button in menu 2 that is on the same position. How could I prevent that?"

You should formulate a plan for using getPointerPressed(), GetPointerReleased() and getPointerState() to get the states you want, when you want them.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Jan 2016 15:31
You need to initialize a flag for when the button is released.


"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 23rd Jan 2016 18:07
For the menu buttons I would do something like this:

13/0

Login to post a reply

Server time is: 2024-03-28 19:27:22
Your offset time is: 2024-03-28 19:27:22