Controlling sprite movement based on whether or not it is overlappin.

0 favourites
  • 3 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • I made two instances of an enemy sprite each with an instance variable called EnemyAction whose values I used in the events to control their behavior. When the two instances overlap a random instance out of the two should have its EnemyAction set to Wait so it stops moving until they are no longer overlapping and it will then start moving again by setting the variable to Move. However I'm not sure how to get it to start moving again after overlapping. Also a new problem came up where both instances get set to wait.

  • You can do it several ways, i might upload a file untill tomorow if i dont explain good.

    But i do it different ways, sometimes i add instance variables on the objects, called "Collision", 0 is false 1 is true. Also i prefer to control the overlapping points myself so i do invisible sprites that i call "enemycol" or something, sometimes its better to use the "on collision" , since its hard getting already overlapped things to not overlap again, especially if the object is not moving. You could use instance variables to detect collision, you will figure it out trust me, theres alot of ways!

    basicly > if object1 collision with object 2 set instance variable "col" of object 1 to 1,

    and do a invert event same as above but right click and click invert on the "is overlapping" , wich means you set the col to 0 cuz its invert, it means it only executes if its not overlapping.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • are the instances of the objects the same sprite or familly?

    if so then u can fix it easy, if they are not in the same familly or part of the same sprite object, then is a bit harder.

    let me know what is the case so i can make u an example.

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