Not equal more than two things

  • C360
  • Novice
  • Novice
  • C360
  • Posts: 23

Post 3+ Months Ago

Can I have a equation equal more than one number? How do I do it!

Example:
Code: [ Select ]
    if ( dir == "up" && _parent.myMap[upY][centerX] != 1) {
        _y -= speed;
    }
  1.     if ( dir == "up" && _parent.myMap[upY][centerX] != 1) {
  2.         _y -= speed;
  3.     }


Can I have that equal not 1 and 2? I tried 1 && 2 and 1|2 and 1||2...can't figure it out. And I dont want two if statements. Appreicate it thanks.

*EDIT*

I just figured out:
Code: [ Select ]
    if ( dir == "up" && _parent.myMap[upY][centerX] != 1 && dir == "up" && _parent.myMap[upY][centerX] != 2) {
        _y -= speed;
  1.     if ( dir == "up" && _parent.myMap[upY][centerX] != 1 && dir == "up" && _parent.myMap[upY][centerX] != 2) {
  2.         _y -= speed;


But if there's a better way I'd appreciate you posting it thanks.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Lord Sivell
  • Novice
  • Novice
  • Lord Sivell
  • Posts: 32
  • Loc: Australia

Post 3+ Months Ago

Hey,

You don't need the second dir == "up". It has already been tested.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 9 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.