How do I destroy depending on position to another object.

0 favourites
  • 3 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hello World,

    So what I am trying to do is destroy objects when they find themselves a certain number of pixels behind a certain object. Now I know what you're gonna ask "Why don't you just use outside of layout behavior?" or "Why don't you just place an object outside of layout at the position you want and everything that collides with it gets destroyed?" I can't use anything like that because(unless I understood this entire part completely wrong) the way I set up my game, the layers themselves don't move, they are prebuilt and the scroll is attached to the player, so he travels through them.

    So I played around for a bit and ended up with an event that basically says every tick if Sky.X is less than Playerbox.X-600 then destroy Sky. Now this works for a few seconds, but as the player travels more his X obviously changes and after a while the sky starts getting destroyed even when it's ahead of the player. So I guess what I need is for the sky to get destroyed depending on the relative Playerbox.X-600?

    Not sure how well I explained it, let me know if I have to be more clear. Thank you guys.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My crazy idea of the day...

    Does your player move in a set direction like an infinity scroller or left and right, up and down like a platformer, or freely move like a huge space style game?

    If its a one direction movement, have you tried pinning an invisible object 600 pixels behind your player and setting anything you want destroyed to be killed if it overlaps it?

    The pinned object will pin at the distance relative to the pinned target upon the pin action, so if you create the pin kill object 600 pixels behind the player and then pin it to player it should keep that distance at all times killing anything that gets that far back...

    Platformer would be tougher but if you pin it to angle as well it should "flip" to other side when you turn to go other way.. (not tested).

    Freeflying type would be toughest using this unless you made the following destroyer object much large and maybe C shaped...

  • One direction movement. Yeah, your idea could work, I'll test it out unless anyone comes up with something better, thanks.

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