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 DBPro Corner / Shutting Down the Routines.

Author
Message
Evangelion
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: United Kingdom
Posted: 19th Apr 2003 20:05
I have a game with several levels, however when you load the second level the first level is still on the screen, they flicker between each other very quickly. And all you can do is press F12 to exit. The same happens when you load back up my Game Main Menu. Each level is written all in a single large routine, this routine also contains little functions so it works. Is there a way to unload the whole level and then re-load the main menu or the next level? Also does anyone know the code to exit the game? eg. User presses 'q' then the game shuts down and returns to Windows.
Not much time has passed but already she likes Concrete better then Grass.
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 20th Apr 2003 04:42
a$ = inkey$ : if a$="q" then end
or you could do it with scancodes
or input
or....

Evangelion
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: United Kingdom
Posted: 20th Apr 2003 16:12
i couldn't get that line to work, it compiled properly but nothing happens when you press 'q'.

Not much time has passed but already she likes Concrete better then Grass.
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 20th Apr 2003 16:44
do you have it located in your main program loop?

CTP

CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 20th Apr 2003 16:44
also are you checking for upper and lower case?
if a$ ="q" or a$ = "Q"

indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 20th Apr 2003 19:18
its important to make sure u flush not only all media but flush arrays and variables that need to be reset.

if u load 50 arrays and 20 objects u need to destroy them for the next level and flush the arrays back to the starting positions for the new level.

k0shi
21
Years of Service
User Offline
Joined: 30th Dec 2002
Location: Cyberspace
Posted: 20th Apr 2003 21:26
if inkey$()="q" then end
or
if keystate(16)=1:end:endif

im the only one thats normal in this world.
everyone else is weird.
Evangelion
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: United Kingdom
Posted: 21st Apr 2003 00:28
its important to make sure u flush not only all media but flush arrays and variables that need to be reset.

if u load 50 arrays and 20 objects u need to destroy them for the next level and flush the arrays back to the starting positions for the new level.


Exactly how do i do that? Is there a command? Any help would be greatly appreciated.

Not much time has passed but already she likes Concrete better then Grass.
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 21st Apr 2003 01:07
there are commands like
delete object
delete image
delete sound
delete array
ect...
before the final END statement you new to go through and delete every media type object you have loaded.
if you don't the users system resources will drop everytime they run the game.

are you getting the inkey or scancode thing to work yet?

CTP

hexGEAR
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 21st Apr 2003 03:27
yeah, i've got a delete function that works for nearly every game, it's just simply the code snipped below.

everyday of life is a new chapter that has already been fortold but is up to the soul to capture.
Evangelion
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: United Kingdom
Posted: 21st Apr 2003 17:53
yeah the code to exit the game by pressing q works fine thanks.
IS there a similar line that by pressing a button a subroutine will run? I want to press 'M' which will return the player to the Main Menu, i have tried the following line but it didn't work:

if keystate(12)=1:gosub main:endif

Can anyone spot the mistake?

Not much time has passed but already she likes Concrete better then Grass.
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 22nd Apr 2003 02:27
if keystate(12) = 1 then gosub main

Login to post a reply

Server time is: 2024-09-20 06:48:36
Your offset time is: 2024-09-20 06:48:36