Checking if condition is NOT true

I feel like this has a super obvious solution and I'm just having a massive brain fart.

I've got an actor that is moving across the screen. I want it to continue moving until it hits another copy of the exact same actor. How do I check if collision with a certain actor is NOT happening?

Comments

  • ThoPelThoPel GermanyMember, PRO Posts: 184
    edited July 2015

    You just use the "Otherwise:" section of a rule:

  • daniel.robert.campbelldaniel.robert.campbell Member Posts: 251

    Thanks, but the problem is that I already have a rule in place that stops the actors movement if they reach the middle of the screen. That part works fine, but I'm having issues passing another condition telling the actor to stop once it's touched another actor.

    It's an enemy, that moves till it hits the middle of the screen. I am spawning more of the same enemy that move into position as well, but I don't want them stacking up on top of each other, so I want one to stop if it's touching another enemy.

  • ThoPelThoPel GermanyMember, PRO Posts: 184
    edited July 2015

    Okay

    if self.position.x >= (device.width/2) then

    • stop
      else

    • if collides with actor of type enemy then
      -- stop

    • else
      -- move forward
      -endif
      endif
  • daniel.robert.campbelldaniel.robert.campbell Member Posts: 251

    Brilliant. Thank you very much!

Sign In or Register to comment.