Page 1 of 1

I don't understand the problem :S

PostPosted: Tue Jul 31, 2012 12:51 pm
by BogdansB
hi,

i have a player and a block. i want the player have a transparancy of 0.8 when you press space. i made it and it works just fine, but now i want to make the player die if he collides with the block when he isn't transparent, but when he is (0.8) nothing happens.

when i try do make it with this script:

Code: Select all
if(player.transp=0)
{
DestroyActor("player");

}


the player gets solid if he collides the block , but when he is solid nothing happens :S

what is wrong with it??

Re: I don't understand the problem :S

PostPosted: Tue Jul 31, 2012 1:27 pm
by AliceXIII
when using an if statement you need to use "==" instead of "=" change it to this and it should work:
Code: Select all
if(player.transp==0)
{
DestroyActor("player");

}


you just had your syntax wrong "=" is for setting a variable like saying transp=.5; "==" is for checking a variable like
Code: Select all
while(transp==.01)
{
    //do something here.
}

or

if(transp==.01)
{
    //do something here.
}

Re: I don't understand the problem :S

PostPosted: Tue Jul 31, 2012 7:34 pm
by BogdansB
yeah right im so stupid :D haha thanks

Re: I don't understand the problem :S

PostPosted: Tue Jul 31, 2012 9:29 pm
by AliceXIII
no problem :) getting used to the syntax is key because most generally most your problems are forgetting something here and there syntax wise..