Solid Behaviour only for Players?

0 favourites
  • Hey,

    just made my own control for player movement. but solid objects are not responding as "solid" for him, since i did not give the movement behaviour. if i give, player is correctly blocked.

    do i need to fix this about events and put the control in a group?

  • If you move an object by events the solid behavior doesn't do anything. It only affects the built-in behaviors.

    Instead, just check for collisions with collision events.

  • Thanks Ashley.

    How about an override of the 8-Direction behaviour?

    I just want the player to be moving via WSAD and the move angle to be set current mouse position.

    If the Player collides with the walls, he cannot move anymore, in any direction. It's a bit hard work without families to do that for 8 different types of walls that should block the player (up-up, down-up, leftleft, and so on) that he can still move in the direction he came from.

    Maybe there could be a bahavour that just enables solid object for an object like a player, so that he just cant be set to positions on which the solid object is placed.

  • I'm not sure what you mean. Can you show with a .capx? If you don't want the object to get stopped by solids, then wouldn't you just take off the solid behavior...?

  • Sorry for my noob english. :D

    I want them to be stopped, but by the solid behaviour of objects, not manually.

    And I dont want to use the standard 8-Direction behaviour on the objects ,that need to be stopped, for this feature to work.

  • Well I'm afraid you can't have both - you have two options:

    1: use the built in behaviors (like 8 direction) which automatically respond to solid

    2: use events to move the object, and add events to handle collisions with solids (which can be pretty tricky).

    For #1, you might get better results using the behavior with an invisible square object which does not animate or rotate, and place the player on top of that. Usually that makes collisions more reliable.

    For #2, it's impossible for Construct 2 to handle collisions with solids for you. Construct 2 does not know what you want to do when an object hits a solid - different games will need to do different things. So you have to set it up yourself with events. That can be tricky - but that's what the behaviors are there for! The behaviors are designed to take care of that for you.

  • xeed: is that what you want ?

    ZQSD_8dir_and_mouse_control_solid.capx

  • Thanks Kyatric. But this is not the solution, since "forward" is always "Up" in 8-Direction Movement. But I want "Up" to move to the current angle.

    As I understood, "Solid" means an area over/on which other objects should not be. In combination with the "Platform" behaviour, this feature interacts with the Movement and the Gravity.

    Here is an example how Solid Objects can work with that simulate stuff in platform mode.

    viral_attack0.3

    And here is what i want, the real WSAD movement in topview, inside a specified area. The grey walls are solid, so how to emulate the actual control with 8 Direction behaviour?

    ad0.1

    Use mouse to aim, and WSAD to move.

    Hope the packages work, UMTS upload is not the best at 7kb.

  • You could use the event "ON COLLISION WITH ANOTHER OBJECT" and teleport the player 5px (or whatever you want) away from one block ... than use instances to "cover" your walls with and voila .. you can use you custom movement.

    PS: Both links are broken

    Cheers

  • thanks Spades, links now working.

    Ur solution is a good idea, but it's not working for me, since i dont know on which side of the block to teleport the player.

    1. because he can walk side- and backward.

    2. the walls are all the same, even if its going horizontal or vertical.

  • It would be really quite handy if the Solid behaviour could be toggled on and off.

  • You can move him by 180� .. so he will be always sent back?

    Cheers

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • so it looks this kind of control cannot be emulated by 8 direction, right?

    the only (easy) way i see, is a collision check with the walls, before moving to the next desired position.

    but thats not very handy, because all movements, even along the wall sideward, will be blocked. also u need temp variables, to store the "old" position.

    but isn't there a trick to get the up/down movement of the direction behaviour to act to the current angle?

  • Maybe the bullet behavior? "WHILE KEY "up arrow" IS PRESSED" set speed to 100 ...

    And so on =)

  • i just got it working. u need to the reset for every key, since multiple keys can be pressed together.

    <img src="http://construct-games.de/content/c2wsadcontrol_blocked.jpg" border="0" />

    well, here is an image inserted, but it is not shown in the post by me.

    anyway, thanks and have fun <img src="smileys/smiley1.gif" border="0" align="middle" />

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