Simulating Collision Behaviour

Get help using Construct 2

Post » Thu Jan 02, 2014 6:45 pm

I am attempting to simulate 8-directional movement using the bullet behaviour. Unfortunately this means I can't use the default collisions that come with it so I was wondering if it is possible to simulate the way 8 direction behaviour deals with collision.

Here is an example of what I have currently. I'm trying to make it so you cannot walk on the red collision mask.

The .CapxJakten2014-01-02 18:46:50
B
5
Posts: 29
Reputation: 758

Post » Thu Jan 02, 2014 6:49 pm

easiest would probably be putting all collision objects in a family and

bullet on collision with family- set speed to 0
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jan 02, 2014 7:01 pm

For some reason on collision doesn't work only overlap does.
This works for stopping him but it stops him from moving in all directions. In the 8-Dir movement you can still move in the other 3 directions while touching the collision object.

I initially figured I could make it so that when you overlap the object you have the object move the character in the opposite direction so that your movement onto the object is always offset but I can't figure out how to do it.

So for each step forward you are forced one step back in the direction you are trying to go until you are off the object.Jakten2014-01-02 19:04:47
B
5
Posts: 29
Reputation: 758

Post » Thu Jan 02, 2014 7:06 pm

Maybe you should set the bullet to bounce of solids to true. I thought the on collision worked with that setting, but I might be mistaken.

Bullets often move too fast (too many pixels per tick) to have accurate collision-detection.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jan 02, 2014 7:19 pm

another option would be to use a while event.
That would become something like this:

is overlapping set bullet speed to 0

while bullet is overlapping - bullet move 5 pixels at angle bullet.angle+180
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jan 02, 2014 7:19 pm

Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Post » Thu Jan 02, 2014 7:35 pm

Yep, that works, but you could also just use is overlapping instead of the system pick collisions action.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jan 02, 2014 7:38 pm

[QUOTE=LittleStain] Yep, that works, but you could also just use is overlapping instead of the system pick collisions action.[/QUOTE]

I actually tried enabling several 'default' methods ... none worked ... especially not directional reply xD

As he stores it in a sepperate value in a player sprite instance variable.

I am not sure it works very efficient though (the controls)
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Post » Thu Jan 02, 2014 7:48 pm

I just replaced the last event with player is overlapping collisions and it still works..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jan 02, 2014 7:56 pm

[QUOTE=LittleStain] I just replaced the last event with player is overlapping collisions and it still works.. [/QUOTE]

lol, figures

The last changes I made was making the direction based on the instance var ^_^    (it didnt work otherwise lol)
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Next

Return to How do I....?

Who is online

Users browsing this forum: LunaticCat, RIDETHEPIG and 9 guests