How do I make a score do something

Game Editor comments and discussion.

How do I make a score do something

Postby He360 » Fri Nov 27, 2009 2:21 am

In the game that I'm making, I'm trying to make it so that when a certain score is reached, a character appears on screen. How do I that?

Thanks
HE
Sometimes you don't need a goal in life.
He360
 
Posts: 22
Joined: Sun Apr 06, 2008 2:21 pm
Score: 0 Give a positive score

Re: How do I make a score do something

Postby skydereign » Fri Nov 27, 2009 4:23 am

Well, you can do it several ways. I will list two. The first requires you to put the event in some global actor, the view is a good actor do use, but sometimes other actors, with more relevant events can work. The following code should be put in that actor's draw event. A note, the x and y positions might be off from what you want, so you might have to tweak them.
view -> Draw Actor -> Script Editor
Code: Select all
if(score==10)
{
    CreateActor("actorName", "animName", (none), (none), view.width/2, view.height/2, false);
}


One thing with this method is that you will need some way of stopping this event from repeating. You can use the actor count of actorName within the conditional, to prevent it from repeating over and over, like this.
view -> Draw Actor -> Script Editor
Code: Select all
if(score==10 && ActorCount("actorName")==0)
{
    CreateActor("actorName", "animName", (none), (none), view.width/2, view.height/2, false);
}



The other method would put the first code example within the event that increases the points. So if the collision event with the goal actor increases score, then you would insert the code after the score increment.
ball -> Collision(Goal, disabled) -> Script Editor
Code: Select all
score++;
if(score==10)
{
    CreateActor("actorName", "animName", (none), (none), view.x+view.width/2, view.y+view.height/2, true);
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron