Score based on killing bad guys:

Game Editor comments and discussion.

Score based on killing bad guys:

Postby d-soldier » Sun May 06, 2007 2:23 am

My problem is that as badguys (who don't get killed by the player) are destroyed offscreen, and as the score is increased in their destory actor event, are increasing the score from offscreen... so how can I script something to determine weather or not the actors are destroyed by the player (and then to increase the score) versus destroyed off screen (and to not add points)... Is there an easy way?
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Sun May 06, 2007 4:20 am

make a variable called Killed(actor variable)
on the out of vision event-> script editor,
Code: Select all
Killed = 1;

when they are destroyed use this
Code: Select all
if(Killed == 0) {
other code here;
                     }

:D
I hope that helps.
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

so

Postby d-soldier » Sun May 06, 2007 3:26 pm

Thats seems so easy... the problem is that since the enemies are off screen before they show up, I actually have a filled region to catch them, rather then an off screen script... so I made it the badguy's collide with killzone(region)script instead... But how does it know to kill him based on "Killed=1" if only "Killed=0" is defined in the destroy actor event? Do I need something like:?

if(Killed == 0) {
CreateActor("dead_mig_l", "mig_fall_00000", "(none)", "(none)", 0, 0, false);;
CreateActor("smoke1", "smoke1_00000", "(none)", "(none)", 0, 0, false);
CreateActor("debris2", "debris2_000000", "(none)", "(none)", 0, 40, false);
CreateActor("score_25", "score_25_01", "(none)", "(none)", 0, 0, false);
}
if(Killed == 1) {
DestroyActor("Event Actor");
}

Thanks for being so helpful as always Sparky!
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Re: so

Postby Sgt. Sparky » Mon May 07, 2007 12:58 am

d-soldier wrote:Do I need something like:?

if(Killed == 0) {
CreateActor("dead_mig_l", "mig_fall_00000", "(none)", "(none)", 0, 0, false);;
CreateActor("smoke1", "smoke1_00000", "(none)", "(none)", 0, 0, false);
CreateActor("debris2", "debris2_000000", "(none)", "(none)", 0, 40, false);
CreateActor("score_25", "score_25_01", "(none)", "(none)", 0, 0, false);
}
if(Killed == 1) {
DestroyActor("Event Actor");
}


Yes. :D
and for collision detection with using a filled region:
make a variable called in.
on collision,
Code: Select all
in = 1;

collision finish,
Code: Select all
in = 0;

:D
and when the player kills him,
Code: Select all
if(in == 0)kill = 1;
else kill = 0;
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron