My Game works first run but not when lives run out and I restart??? HELP =)

Previous topic - Next topic

spicypixel

I have just started writing a mini platform engine and am building a framework. Presently the game works (although code needs tidying) however when your lives run out and I use GOTO to restart the level, GOTO menu or GOTO load level again it restarts but then kinda hangs. Please find attached the project, source and external files so that you can look and help in anyway possible.

Thank in advance for taking the time to assist however possible.

Source and Files
http://www60.zippyshare.com/v/61077970/file.html

Game Screenshot



Controls
Use the left and right mouse buttons to rotate and move the bouncing ball.
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

Kitty Hello

Aw, I found it.

Code (glbasic) Select

GLOBAL PlayerX = 240
GLOBAL PlayerY = 160
...



With GLOBALS in GLBasic it's like this:

GLOBAL a = 5 // the global variable "a" will be created at the program start and has a value of 5 (even if you write this below the first use of "a".

If you want to "assign" a global variable "when the program runs", you have to explicitly do that again:

Code (glbasic) Select

GLOBAL a=5
a=7


Code (glbasic) Select

GLOBAL a=12
GLOBAL a=7



Code (glbasic) Select

GLOBAL a
a=7


I'm sorry that you stumbled for that.

[edit] The game looks super cool! I'd buy that for a dollar.




spicypixel

I kept commenting out my code until I literally had the globals defined and eventually found it, but thank you for the swift reply and nice words about my mini platformer :-)
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

matchy

It's cool and I like it.

Looking at the level maps (editor), I wonder about the efficiency of having it as a post rendered map from tile-set rather than creating that map in run init or render the scene in game loop. Even the coins are hard codes where they should be on another map layer.

spicypixel

Yeh I was thinking about both efficiency and memory having it as a pre-rendered map rather than a tileset with edge update. But this was really for speed atm rather than how it will end up. I just like seeing result and this way was easier and quicker to get something up and running :)
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

Gary

Very nice little game you have going there and I could see it being a nice iPhone/android game as well

Good example of neat code as well I think, definate one for the showcase or even as a sample in the samples menu on the IDE

Not Angry Birds but I think you could do well if you decided to sell it

spicypixel

Quote from: Gary_Leeds on 2011-May-04
Very nice little game you have going there and I could see it being a nice iPhone/android game as well

Good example of neat code as well I think, definate one for the showcase or even as a sample in the samples menu on the IDE

Not Angry Birds but I think you could do well if you decided to sell it

Thank you Gary for your kind words =) To be fair I'm a graphic artist first and programmer second so to say the code is neat is indeed nice too, although it could be more compact but I'll get there. It's intended to be an iPhone game and as you say would be good for the Android too so hopefully it'll make me a few pennies lol =D
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.