Solid Behaviour only for Players?

Discussion and feedback on Construct 2

Post » Sat Oct 22, 2011 9:48 pm

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?
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Sat Oct 22, 2011 9:57 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Sun Oct 23, 2011 2:45 pm

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.xeed2011-10-23 14:47:37
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Sun Oct 23, 2011 3:16 pm

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...?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Sun Oct 23, 2011 3:21 pm

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.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Sun Oct 23, 2011 3:33 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Sun Oct 23, 2011 4:32 pm

New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Sun Oct 23, 2011 5:03 pm

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.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Sun Oct 23, 2011 5:23 pm

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
B
17
S
4
G
4
Posts: 94
Reputation: 3,058

Post » Sun Oct 23, 2011 6:03 pm

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.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 19 guests