Solid Objects

Discussion and feedback on Construct 2

Post » Sun Aug 24, 2014 10:57 pm

Message: carvear is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
I want the monsters and player are solid, so they can not overlap. Use behavior and lower solid examples, but does not work. Under the file.
The player can not move, do not move. He always has a fixed position in the game. thank you
B
2
Posts: 2
Reputation: 154

Post » Sun Aug 24, 2014 11:15 pm

I'd like to know too.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
91
S
30
G
22
Posts: 1,985
Reputation: 20,149

Post » Mon Aug 25, 2014 3:02 pm

I managed this with Solid + Bullet with BounceOff Solids Yes.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,038

Post » Tue Aug 26, 2014 12:24 am

Doesn't work... But, if i can't do this, what about just horizontally? How do i do it?
B
2
Posts: 2
Reputation: 154

Post » Tue Aug 26, 2014 6:47 am

In my experience "Bounce Off Solids" works well only when bouncing off of stationary objects.

For example this uses "Bounce Off Solids" for everything.
https://dl.dropboxusercontent.com/u/542 ... owd_1.capx
Notice unsightly teleportation when objects get in close quarters.

So one Idea that eliminates the teleporting is to have the enemies not have the solid behavior and resolve their collisions as they move with events. Basically it involves checking the distances of every enemy with all the others. If the enemies are too close we can calculate exactly how much they are overlapping and then can move one enemy half the overlap one way and the other enemy half the distance the other way.
https://dl.dropboxusercontent.com/u/542 ... owd_2.capx
One thing that is not addressed is changing the enemy's speed. They will appear to stop until the path is free and they will jet back at their original speed.

In this final example I addressed the lack of bouncing. To do it I needed to get and set velocity x and y so I opted to remove the bullet behavior and do the movement with events.
https://dl.dropboxusercontent.com/u/542 ... owd_3.capx
It works well, but there is no collision response with the walls.

You could make example 2 work with the bouncing in example 3 by converting the bullet behavior's speed and angleOfMotion to vx and vy with:
vx=speed*cos(angleOfMotion)
vy=speed*sin(angleOfMotion)

doing the calculations and then converting back with:
speed=distance(0,0,vx,vy)
angleOfMotion=angle(0,0,vx,vy)


Another idea would be just to use the physics behavior for the whole bit.
B
94
S
33
G
113
Posts: 5,353
Reputation: 73,267

Post » Wed Aug 27, 2014 1:30 am

Could we just get behavior that would take care of it please?
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
91
S
30
G
22
Posts: 1,985
Reputation: 20,149


Return to Construct 2 General

Who is online

Users browsing this forum: technofou, TheFoXeletan and 3 guests