Is overlapping at offset not working

Discussion and feedback on Construct 2

Post » Fri Jul 22, 2016 11:00 am

I'm trying to create a custom collision checking system for our isometric game project. The idea was to check the target position before making any movement by the "Is overlapping at offset" event. If there's no overlapping happening at the target offset, then the movement can be made. However I don't quite understand that why is the following script doesn't work. I replaced the actions a bit for testing purposes to have it destroy the colliding object instead of stopping the movement. But no matter how I try it, the logic simply ignores the overlapping coordinates, the house won't get destroyed, I can move straight through it.

Both objects have their collision enabled, polygon set up, are on the same layer. Any help would be appreciated.

Image
B
135
S
33
G
17
Posts: 1,557
Reputation: 20,715

Post » Fri Jul 22, 2016 11:34 am

That 'offset' is middle in your object.

Check offset at
Self.X - distance*sin(60)
Self.Y - distance*cos(60)

Where distance is anything you need.
To see what you are dooing, you can move a small sprite at
test_player.X - distance*sin(60)
test_player.Y - distance*cos(60)

I see that youre player is a circle, that offset will also be a circle.

Dont forget to move it 'back' when a overlapping is dedected. Else it keeps overlapping. You have to make a sorta 'push out of solids' routine.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Jul 22, 2016 3:26 pm

99Instances2Go wrote:That 'offset' is middle in your object.

Check offset at
Self.X - distance*sin(60)
Self.Y - distance*cos(60)

Where distance is anything you need.
To see what you are dooing, you can move a small sprite at
test_player.X - distance*sin(60)
test_player.Y - distance*cos(60)

I see that youre player is a circle, that offset will also be a circle.

Dont forget to move it 'back' when a overlapping is dedected. Else it keeps overlapping. You have to make a sorta 'push out of solids' routine.

Thank you for the answer. I tried changing the expression to what you are suggested (I used different numbers for distance, 10; 70; etc..), but still not working.

Edit: Well, not quite the answer to this problem, but I managed to get the collision system working using the custom movement behavior's push out solid (nearest) option.
Last edited by glerikud on Fri Jul 22, 2016 3:43 pm, edited 1 time in total.
B
135
S
33
G
17
Posts: 1,557
Reputation: 20,715

Post » Sat Jul 23, 2016 4:51 pm

I figured out an other solution, and it works just as I intended. I drop this here if anyone interested:

Image
B
135
S
33
G
17
Posts: 1,557
Reputation: 20,715


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 6 guests