I don't understand the problem :S

Talk about making games.

I don't understand the problem :S

Postby BogdansB » Tue Jul 31, 2012 12:51 pm

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??
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: I don't understand the problem :S

Postby AliceXIII » Tue Jul 31, 2012 1:27 pm

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.
}
"Taking a breath of fresh air."
User avatar
AliceXIII
 
Posts: 325
Joined: Fri Sep 17, 2010 2:36 am
Location: victoria, texas
Score: 37 Give a positive score

Re: I don't understand the problem :S

Postby BogdansB » Tue Jul 31, 2012 7:34 pm

yeah right im so stupid :D haha thanks
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: I don't understand the problem :S

Postby AliceXIII » Tue Jul 31, 2012 9:29 pm

no problem :) getting used to the syntax is key because most generally most your problems are forgetting something here and there syntax wise..
"Taking a breath of fresh air."
User avatar
AliceXIII
 
Posts: 325
Joined: Fri Sep 17, 2010 2:36 am
Location: victoria, texas
Score: 37 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest