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 / Sample Menu code

Author
Message
dijster
12
Years of Service
User Offline
Joined: 16th Aug 2011
Location: Sheffield, UK
Posted: 24th Aug 2011 12:13
I've been playing around with AppGameKit and thought I'd see how easy it was to write a simple menu system for a game.
30 minutes later, here it is.
Obviously it would require the buttons placing where you want and images, etc... but it should be a good start for people.


I am only just starting with this language, so there may be a lot better way of doing things that I haven't come across yet.
DIJ

Very funny Scotty, Now beam my clothes up!
Bursar
15
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 24th Aug 2011 14:13 Edited at: 24th Aug 2011 14:13
Looks OK. I think the only thing I'd do is change the ButtonTidy code to a loop (less typing), and also move it into a seperate function so you can call it from other places if you need to.

I can't see the point in mixing functions and gosubs either...

Updated Menu code.


One nice thing to have (but I don't think AppGameKit currently supports it) would be to detect when the mouse is over the button.

You could also it to detect if the mouse button was released whilst it was still over the button. Currently clicking on a button, dragging the mouse over a different button and then releasing still activates the first button. There's no way to change your mind if you have clicked on an incorrect button.

Something like:
dijster
12
Years of Service
User Offline
Joined: 16th Aug 2011
Location: Sheffield, UK
Posted: 24th Aug 2011 14:56
Thanks for your input, I'm still a newbie with AppGameKit but learning more all the time.
I wasn't too fussed about detecting if a button had a mouse over as this is mainly for iOS games, but that would be good for porting to windows.
I hadn't considered that a user could press a button, move their finger and release and it would still be counted as a press, thanks for highlighting that for me.

Very funny Scotty, Now beam my clothes up!
dijster
12
Years of Service
User Offline
Joined: 16th Aug 2011
Location: Sheffield, UK
Posted: 24th Aug 2011 15:23
Here is a re-worked version, that also makes sure the player is still clicking the button when released.



Very funny Scotty, Now beam my clothes up!

Login to post a reply

Server time is: 2024-04-25 16:20:22
Your offset time is: 2024-04-25 16:20:22