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.

Dark GDK / wierd function exit

Author
Message
ichimeno
16
Years of Service
User Offline
Joined: 1st Dec 2007
Location:
Posted: 29th May 2010 01:01
Hello everyone. Im a bit new here, but been reading quite a bit in this forum. I'll have to admit, it appears to be really friendly. Well anyway, so today I've decided to work on my first "big" project, pong clone for the first time. After getting the clone to work, I decided to create a menu. In the menu function ( I call it Menu() ) I wrote that if the user clicks on "start", the Game() function gets called.

The problem is, when I actually click the "start", the funtion does get called but then exits 1 second later. And I really cant figure out whats causing this. Anyone have maybe an idea on what is going on?

By the way the function looks a bit like this:



Thank you in advance!
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 29th May 2010 01:13 Edited at: 29th May 2010 01:14
Cant tell from that code exactly what your problem is but here is how its done in one of the tutorials, roughly.

Your game should have a 'state' variable, for ease lets just use an integer value:



Then in your 'while' loop you check the state and run the correct function:



Your mouse click then becomes something like this:



Hope that helps.

ichimeno
16
Years of Service
User Offline
Joined: 1st Dec 2007
Location:
Posted: 29th May 2010 01:24
Oh, thank you! I didn't think of it like that.

Login to post a reply

Server time is: 2024-11-19 23:27:04
Your offset time is: 2024-11-19 23:27:04