Quick scripting question

Non-platform specific questions.

Quick scripting question

Postby BS87 » Sat Aug 27, 2011 6:21 pm

Hi,
currently finishing up my project and got a question how to write the following in script editor (if it even is possible) since I don't know the functions of all the commands yet:

if(Player 1 collides with switch)
{
if(Player 2's current animation is X)
{
Change Player 2's animation to Y
}
}

The problem is that, with my current knowledge, I only am able to give Player 1 another animation as soon as he hits the switch, but not player 2. The switch so far triggers a variable which changes the players animations as soon as he moves, but since I got two players and one of them switches, the other one may not move at the moment and the animation stays the same. Hard to describe and understand, I know, but I would need help for that. Thanks!
BS87
 
Posts: 8
Joined: Thu Aug 04, 2011 2:12 pm
Score: 0 Give a positive score

Re: Quick scripting question

Postby skydereign » Sat Aug 27, 2011 6:51 pm

Well, first are they the same actor? Or are they like player1 and player2? If the latter, most of the functions in gE, such as ChangeAnimation, allows you to pick another actor but it defaults to "Event Actor". If you change that to player2, then it will change player2's animation. But anyway, the first if statement you have is taken care of a collision event with the switch.
player1 -> Collision with switch -> Script Editor
Code: Select all
if(player2.animindex==X)
{
    ChangeAnimation("player2", "Y", FORWARD);
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Quick scripting question

Postby BS87 » Sat Aug 27, 2011 7:53 pm

Thanks bro! Exactly what I needed! :D
BS87
 
Posts: 8
Joined: Thu Aug 04, 2011 2:12 pm
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest