levels and actors

Game Editor comments and discussion.

levels and actors

Postby ckn087 » Wed Oct 19, 2016 1:28 am

What is the best way to make actors? I'm wanting to add a new enemy character each level. Like level 1 has 1 enemy, level 2 has 2 enemy characters and so forth. Everytime I kill one of the 2 on level 2, it destroys both of them? I don't understand what i'm doing wrong. I have a variable that is global integer so that they have to be shot 3 times before they get destroyed. Also what is the best way to create levels? I have them in separate ged files but i heard that wasn't the best idea in case i want to change a character like (player) because i would have to change it in every ged file.
ckn087
 
Posts: 30
Joined: Thu Jan 14, 2010 12:29 pm
Location: U.S.A
Score: 1 Give a positive score

Re: levels and actors

Postby Hares » Wed Oct 19, 2016 4:27 pm

You are using a global variable for the damage, but in this case you want to use a actor variable.

If you use a global variable, that means there is 1 variable in the whole game.
So any time you register damage, it will register to this 1 variable.

If you make an actor variable, then each actor will have his own instance of that variable.
Now when you take damage, you only affect the variable for that 1 actor.
User avatar
Hares
 
Posts: 104
Joined: Fri Dec 20, 2013 8:39 pm
Location: Belgium
Score: 13 Give a positive score

Re: levels and actors

Postby ckn087 » Wed Oct 19, 2016 11:49 pm

Ok here is what I have done. I have made an enemy actor (enemy1) I made an array of about 5 of them by clicking clone. I made a variable called enemy_hits. I have it set in script editor to where when player bullet collides with enemy 1 (enemy_hits --; and it is set to actor variable now and they still all die at once. Idk what I done wrong lol thanks for any help I can get!
ckn087
 
Posts: 30
Joined: Thu Jan 14, 2010 12:29 pm
Location: U.S.A
Score: 1 Give a positive score

Re: levels and actors

Postby schnellboot » Fri Oct 21, 2016 11:04 am

As Hares already said, it is important to declare the variable as "Actor Variable" and not "Global".
schnellboot
 
Posts: 815
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 97 Give a positive score

Re: levels and actors

Postby ckn087 » Sat Oct 22, 2016 6:52 pm

It was already set as actor variable. I found my problem. I had an event set to draw actor/script editor: if enemy_hits ==0 destroy enemy instead of destroy event actor. Lol thanks for the help guys
ckn087
 
Posts: 30
Joined: Thu Jan 14, 2010 12:29 pm
Location: U.S.A
Score: 1 Give a positive score

Re: levels and actors

Postby Hares » Wed Oct 26, 2016 8:32 pm

ckn087 wrote:Also what is the best way to create levels? I have them in separate ged files but i heard that wasn't the best idea in case i want to change a character like (player) because i would have to change it in every ged file.

I would make multiple .ged files:
- One for the intro and/or menu
- One for each level

When you export the intro (file -> export), you choose an executable file format. This will generate an .exe file
When you export the levels, you choose "game data only". This wil generate a .dat file, which is the same as the exe but without the game engine included.

In your game you just load the .dat file with the load game function(LoadGame("Level1.dat")

The tricky thing is that if you have variable that should keep it's value (score, lifes, upgrades, ...) you should export the variables to a text file before you load a new level, and read the text file after loading the level.

Hope this helps
User avatar
Hares
 
Posts: 104
Joined: Fri Dec 20, 2013 8:39 pm
Location: Belgium
Score: 13 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron