Page 1 of 2

Game Over

PostPosted: Mon Sep 20, 2004 5:47 pm
by VYTIS_KNIGHT
1. How do I have it in a game that when all levels are completed or the player is out of ships that it displays GAME OVER? I have looked at all the demos and am a bit confused.

PostPosted: Tue Sep 21, 2004 5:23 am
by Just4Fun
1. How do I have it in a game that when all levels are completed or the player is out of ships that it displays GAME OVER? I have looked at all the demos and am a bit confused.


Hmm. If I am understanding you correctly, one way to do this would be to use a global shipCounter to track the number of playerShips in the game(Use local variables to track the ships in each level.)

You could then decrement the global variable 'shipCounter' as each ship is destroyed.

shipCounter =10; shipCounter <=10; shipCounter=shipCounter -1;

When the last ship is destroyed, the shipCounter would = 0.

If the shipCounter = 0 then you could either clear your current screen and display your "Game Over" text or move the view to a different activation area to show your ending "Game Over screen.

Hths...

PostPosted: Wed Sep 22, 2004 2:33 am
by VYTIS_KNIGHT
If the shipCounter = 0 then you could either clear your current screen and display your "Game Over" text or move the view to a different activation area to show your ending "Game Over screen.


Can I redirect it to a certain activation area on the main screen exe?

Example: the game has a main.exe and it loads each level1.dat, level2.dat, and so on. Can I have it go back to a certain activation area in main.exe or would it be better to create gameover.dat?

PostPosted: Wed Sep 22, 2004 2:55 am
by VYTIS_KNIGHT
Also How can I write in the script editor the following?

if ships.textNumber > = 0 then ships.textNumber = ships.textnumber - 1;
if ships.textNumber = 0 then LoadGame("GameOver.ged")

PostPosted: Wed Sep 22, 2004 3:14 am
by Just4Fun
Hi VYTIS:

Again, if I am understanding your question correctly: Yes. You could move to whatever Activation Region you want.

You could do something like:

if( shipCounter <= 0) //if the global shipCounter decrements to 0. Trigger the move to the Activation Region.
view.x = -1080 //the x coordinate of your "GameOver" activation region.
view.y = -160 //the y coordinate of your "GameOver" activation region.

Look at the demo that I posted called "Smiley Catch". It is a very simple demo that shows one way to deal with levels and movement to various Activation Regions. It uses level timers to control the amount of time a player has to play and the speed of the Smiley so it won't show you how to count your ships, but it will give you a pretty good idea of how Activation Region movement works. Hths

PostPosted: Wed Sep 22, 2004 3:57 pm
by Just4Fun
Also How can I write in the script editor the following?

if ships.textNumber > = 0 then ships.textNumber = ships.textnumber - 1;
if ships.textNumber = 0 then LoadGame("GameOver.ged")



Once again, I think that you may be wrestling with variables.

You could define a variable to track the shipCount, and then, display the counter variable number in the textNumber. Finally, you could test the textNumber using the value stored in the shipCount variable.

shipCount=shipCount-1;
ships.textNumber=shipCount;
if(ships.textNumber = 0);
LoadGame("GameOver.ged");

Keep studying the tutorials and also the user demos. Jazz-e-bob has posted some good stuff. I learned a lot about timers from studying his code. I tried to heavily comment my demos and they usually deal primarily with one aspect of GE. ie Activation Regions, score keeping, timers, etc.

Once you get something together, please post a demo for us all to enjoy.

Peace....

PostPosted: Fri Sep 24, 2004 1:51 am
by VYTIS_KNIGHT
I have it subtracting the ships that are left when the main ship gets destroyed. I have folled all the demos that I can, but I can not get the main ship to reappear. What are the steps needed? I followed the asteroids demo and have gotten this far, but I can not figure out how to have the main ship reappear after the counter ship has disappeared.

"GAME MAKER, who needs that?"

PostPosted: Fri Sep 24, 2004 2:34 pm
by Just4Fun
Kool VYTIS:

It sounds like your are making progress in your game.

I am sorry, but I don't quite understand what you want to do next. Could you write the steps in psuedo code?

Like:

1. Create the actor.
2. Destroy the actor.
3. Add one to player score.
4. Draw the actor at a new random location.

Then maybe I will understand. Or, if someone else understands, please don't hesitate to jump right in... :lol:

PostPosted: Fri Sep 24, 2004 3:13 pm
by VYTIS_KNIGHT
1. Actor gets hit buy enemy bullet.
2. Actor is destroyed.
3. Ship1(counter for lives) in upper part of screen is destroyed.
4. If lives greater than 0 create actor(ship/player). This is the part I am having problems with. I have studied Asteroids demo and could not get it to work in my game. I need to have it create actor(player/ship) if lives greater than 0.

PostPosted: Fri Sep 24, 2004 5:06 pm
by ingsan
Hi Vytis !

Concerning this part of your problem :
    If lives greater than 0 create actor(ship/player). This is the part I am having problems with. I have studied Asteroids demo and could not get it to work in my game. I need to have it create actor(player/ship) if lives greater than 0

On which Actor have you written the CreateActor code (when your actor has to be re-created after Destruction) ? Is it on the actor itself or on another actor :?:

PostPosted: Fri Sep 24, 2004 5:09 pm
by VYTIS_KNIGHT
On the actor itself.

PostPosted: Sat Sep 25, 2004 12:00 am
by makslane
Don't destroy the actor, just change your visibility state

PostPosted: Sat Sep 25, 2004 9:29 am
by ingsan
Hi Vytis :)
The reason why your actor doesn't reappear is that it has been Destroyed.
So, any code that you put on him won't work as he NO LONGER exists in the scene.

Two things you can do to solve your problem :
:idea: Follow Maxslane's advice. Instead of DESTROYING your actor, just put a Visibility Action.
:idea: Or, put your code on ANOTHER ACTOR which is not seen in your game. Tell the latter that after Destruction, your main actor reappears.

I hope it works !

PostPosted: Sun Sep 26, 2004 1:53 am
by VYTIS_KNIGHT
Can you give me a step by step instructions? What actor would I put the enable scripting on?

PostPosted: Sun Sep 26, 2004 6:28 am
by Just4Fun
VYTIS:
Assuming that you are using Makslane's suggestion regarding using the Visibility function, and that your playerShip VisabilityState is DISABLED, you could simply test your previously created global counter (ie "shipCounter"):

if (shipCounter = 0) // or some other integer that you want to check
{
VisabilityState("playerShip",ENABLE); //make the player ship reappear.
}

Ingsan has mentioned a good tip: Sometimes it is easier and more efficient to create another actor off screen to take care of initialization,timing, counting, etc of a particular actor.

*Are you using the "variables/functions" popup list in the script editor? It is very useful at helping to complete scripts and also to learn the functions offered in GE. You can access the VisabilityState function from there and it will walk you through creating the script function for the editor... Hths......