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);
}