Stopping against a solid <RESOLVED>

Get help using Construct 2

Post » Sun Nov 13, 2011 10:28 pm

Dear all.

Noob question #3

Okay, I have my object moving about the screen and I have a object with the solid behaviour assigned to it.

When my movable object comes into contact with the solid object, it just passes straight through as if it wasn't there.

I can detect contact as I have triggered other events when they touch; however, how do I make the solid actually act as a solid and prevent my movable object from passing though it?

Other than the 'solid' behaviour, I want to do this using events only.

Many thanks.


Noobutternoob2011-11-14 07:02:42
B
5
G
2
Posts: 17
Reputation: 1,266

Post » Sun Nov 13, 2011 11:57 pm

[quote]Other than the 'solid' behaviour, I want to do this using events only.[/quote]
Than the solid behavior is useless. By design it is supposed to interact with object having behaviors like 8direction, car or even platformer behavior.

Since you are already determining when you have a collision in event, then "bypass" your movement at this moment.
This depends on how you have implemented the moving of the object. Without a capx, hard to figure/answer.
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,998
Reputation: 57,786

Post » Mon Nov 14, 2011 2:56 am

Make the solid object have a physics behavior and set this object to be immovable.
B
19
S
3
G
3
Posts: 56
Reputation: 2,496

Post » Mon Nov 14, 2011 3:01 am

@Tuiii it will only work if the base moving object has a physics behavior too.
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,998
Reputation: 57,786

Post » Mon Nov 14, 2011 3:25 am

Oh, didn't see he said he wanted only the solid behavior. Well.. capx would help to understand better here indeed.
B
19
S
3
G
3
Posts: 56
Reputation: 2,496

Post » Mon Nov 14, 2011 5:06 am

You are going to have to do collision detection manually in events, which is quite annoying.

Essentially, you should do some reading about how collision detection works, but basically it detects whether an object has collided with another, and then checks if that object has a solid attribute, and then pushes it back to the last position it was at. Alternatively you can calculate whether or not the next movement will collide (in the next frame), and have the main character not move in that direction.
B
14
S
1
G
2
Posts: 85
Reputation: 2,810

Post » Mon Nov 14, 2011 7:00 am

Thank you, all.

I do search the forums and examples prior to asking questions here, but maybe their very simplicity means I get 1000s of unrelated results!

Thank you for exlaining that the solid behaviour only works with other behaviours and that, therefore, my only option is to perform a fiddly advance check on key press, but before movement.

Perhaps I'm trying to reinvent the wheel here, hmmmm!


Noobutternoob2011-11-14 07:01:14
B
5
G
2
Posts: 17
Reputation: 1,266

Post » Mon Nov 14, 2011 7:30 am

In the Search options, be sure to select the forum "Construct 2 general". If nothing useful pops up select the forum "How do I".

The answers will only concern C2.
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,998
Reputation: 57,786


Return to How do I....?

Who is online

Users browsing this forum: anty21ro, badmoodtaylor and 13 guests