cloudll Posted August 16, 2011 Share Posted August 16, 2011 Hi guys, I was wondering if someone could help me with the if statement, I have tried tweaking it in various different ways with no luck. I'm looking for it to do something like this <?php if ($pos_x < 30) { echo "you hit a wall!"; if ($pos_x > 240) { echo "you hit a wall!"; if ($pos_y < 30) { echo "you hit a wall!"; if ($pos_y > 240) { echo "you hit a wall!"; ?> Any help would be greatly appreciated Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted August 16, 2011 Share Posted August 16, 2011 if ($pos_x < 30 || $pos_X > 240) { echo "You hit a wall"; } if ($pos_y < 30 || $pos_y > 240) { echo "You hit a wall"; } Quote Link to comment Share on other sites More sharing options...
Psycho Posted August 16, 2011 Share Posted August 16, 2011 if ($pos_x < 30 || $pos_x > 240 || $pos_y < 30 || $pos_y > 240) { echo "You hit a wall."; } Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted August 16, 2011 Share Posted August 16, 2011 if ($pos_x < 30 || $pos_x > 240 || $pos_y < 30 || $pos_y > 240) { echo "You hit a wall."; } Gah! You're right. Man, I need to get to bed.... Quote Link to comment Share on other sites More sharing options...
cloudll Posted August 16, 2011 Author Share Posted August 16, 2011 Thanks guys, worked a treat Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.