Super Basic Collision Question

This forum is currently in read-only mode.
0 favourites
From the Asset Store
A full Spriter-based Platformer engine for C2 or C3
  • I have an object that is controlled by the player. This object will be invisible during run-time, but it is a 64x64 object that the camera follows. I have placed two 64x64 boxes at each side of the level to stop the object from going beyond a certain point (most importantly the edge of the level). I can't seem to make the player's object stop when it collides with one of the boxes. I have tried using the movement behaviour "stop", but that just creates a JELLO effect.

  • use set position and keep setting its postion to the level boundary if goes past it.

  • Are you using the platform behaviour? If you are you don't need to manually set the collision, just set the collision item to 'solid' under attributes. I think this is true of all the behaviours.

  • use set position and keep setting its postion to the level boundary if goes past it.

    It isn't hitting the boundary of the level. I'm not using the platformer behaviour. So I'd have to create two objects that set PlayerSight.X to "PlayerSight.X - whatever" for the right side and "PlayerSight.X + whatever" for the left side?

  • It isn't hitting the boundary of the level. I'm not using the platformer behaviour. So I'd have to create two objects that set PlayerSight.X to "PlayerSight.X - whatever" for the right side and "PlayerSight.X + whatever" for the left side?

    It doesn't matter what it's hitting, you can just use system compare to check if the object passes a certain position and then set it to the maximum point you want it to be at. You probably don't need to make objects for this, and it doesn't matter if your using a behavior or not. A cap would help though, since I don't really know exactly what you want .

  • Sorry, I didn't think a cap was necessary because the problem is so basic. All I'm looking for is an object to stop moving when it runs into another object, that's it.

  • I have placed two 64x64 boxes at each side of the level to stop the object from going beyond a certain point (most importantly the edge of the level).

    What Davio said. You don't need objects, just set the position it shouldn't travel beyond.

    Something like this: http://dl.getdropbox.com/u/2306601/StopRightNow_001z.cap

  • I've already done that, thank you for showing me, but I'm looking for an answer to the previous problem. If I had an object that is traveling, for example, along the x axis, how do I make it stop moving when it collides with another object?

  • Is this what you're looking for?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That might be relevant if "bounce" does what I think, but I'm not looking for anything nearly as complicated. Maybe I'm explaining it rather poorly, because this is very basic. Say I have A BOX moving along the X AXIS and it COLLIDES with another BOX so I want it to stop moving.

  • Say I have A BOX moving along the X AXIS and it COLLIDES with another BOX so I want it to stop moving.

    You never actually stated which method you are using to move your sprite. And I still don't really get the problem tbh.

    If your using a movement behavior, you would just set the speed to 0 on collision or when overlapping.

    On collision between Sprite A and Sprite B

    Sprite A Set speed to 0

    Of course if your sprites are instances of the same object and picking is your problem, you'll need to add 2 different families to the object and check for collision between family A and family B instead.

    If it's still not what you're actually asking I suggest you throw in a cap.

  • Okay is this supposed to become a physics game/tryout or something? Since the player has physics behavior, but you set its position with events. You don't want to do that if that's the case. Add force/velocity with events and stuff. And other things it collides with need to have physics behavior as well.

    Or is it just accidently in there and you absolutely want to move your sprite with events? Sprite.X + Value*TimeDelta Style?

  • That was just me dicking around, assume the position should be set.

  • You could do something like this. I'm still new with Construct, so don't mind the mess, and I'm sure there's plenty more ways to achieve this.. But this is what I came up with...

    http://theone.lithfaq.com/timedelta.zip

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