How to Overlapped Objects Stick to platform and can move?

Get help using Construct 2

Post » Thu Nov 24, 2016 2:53 am

hi, im trying to make a game where the player can go on platform 2d orthographic, but the platform can be anything and sometimes they rotate.

this formula does not work:

Code: Select all
//from game object name "obj"
>> While Obj overlap platform
obj.dist_x = (obj.X - platform.X)
obj.dist_y = (obj.Y - platform.Y)

//below is this formula -> radius = sqrt ( (dist_x)^2 + (dist_y)^2 ) to find distance of points between obj and platform vectors

obj.radiusToPlatform = sqrt( (obj.dist_x * obj.dist_x) + (obj.dist_y * obj.dist_y) )

//below I find in research that atan2(dist_y, dist_x) == angle(0, 0, dist_x, dist_y) in construcyt 2  game engine... so i use it this way, but i mean this: "atan2(dist_y, dist_x) + platform.angle"

obj.angleToPlatform = angle(0, 0, obj.dist_x, obj._dist_y) + platform.angle

//now i set position on top of platform and make sure to factor rotation and angle of it
obj.X = platform.X + obj.radiusToPlatform  * cos(obj.angleToPlatform)
obj.Y = platform.Y + obj.radiusToPlatform * sin(obj.angleToPlatform)

anyway this does not work in construct 2 game engine, why???
other game engines this is standard and works fine. :cry:

pls, moving at angle does not works well. it is bad. :(
to explain I need object to not slide around but move with rotation like on a train. or stage platform orthographic view. but still stay in local coordinates the same....... pin movement does not allow offset x and y or added movement, this is not good. :oops: :!:
Posts: 5
Reputation: 160

Post » Thu Nov 24, 2016 3:37 pm

hm.. maybe it a bug with construct 2.. i give up
Posts: 5
Reputation: 160

Post » Thu Nov 24, 2016 6:39 pm

upload a capx file.
Posts: 200
Reputation: 8,322

Return to How do I....?

Who is online

Users browsing this forum: saour and 6 guests