Triggering events for objects at certain point

  • I have some dogs that I spawn on either the left hand side, or the right hand side. When they are created I give an instance variable a value of int(random(48, 592)) and they run across the screen. I am trying to trigger a series of events when the dogs reach an x position of int(dog.x) = dog.pooSpot Currently, I am doing it like so:<img src="http://i.imgur.com/3lqJJQa.png" border="0" />

    however, it's not getting all the dogs to go poo. How can I make sure they all do it?

  • the dog is probably passing over the pooSpot so the condition is never met

    if the pooSpot.x is 200 for example..

    the dog.x might go from 198 to 202 in a single tick.. it depends on its speed

    a way around this would be to change

    pspot = int(dog.x)

    to

    system| is inbetween values:

    pspot.x-16 > dog.x > pspot.x+16

    this means if the dog is within 16 px of the spot, the condition is met.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • That makes perfect sense, thanks a bunch.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)