Collisions maths

Get help using Construct 2

Post » Tue Nov 05, 2013 4:56 am

I'm currently working out maths I've written for game maker and the functions should transfer over but I also love to have confirmation especially before jumping in and creating plugins if it's not worth the effort.

The game well I should say kit I'm planning is Seiken Densetsu 3, now it's sad that C2 doesn't have scripting but it does have an SDK but for plugins.... I don't know if I can write mode7 in a plugin but if I can please let me know as C2 should be at this point as powerful for 2D games as the PS2 considering the PS2 SDKs were out in the late 90s to developers.

On to the collision maths.
degree = radtodeg(arctan2(vec1.y - vec2.y, vec2.x - vec1.x));

Now the vec1 variable would be for the player (or ally who is attacking) and vec2 is for the enemy on screen.

Remember when you played zelda or seiken densetsu? If you say it the enemy on the lower portion he would move back diagonal up, the opposite would be diagonal down, smack dab in the middle would just be pushed back in the opposite direction.

Any easy way without diving into the sdk to port this over?
Working on a Action RPG
Posts: 18
Reputation: 2,734

Post » Tue Nov 05, 2013 5:32 am

Im not sure what any of what you posted has to do with collisions.

It looks more like you are trying to set up a movement.
Image ImageImage
Posts: 8,223
Reputation: 105,065

Post » Tue Nov 05, 2013 6:20 am

Well, mode7 can be done with an effect for the visual portion.

[quote]radtodeg(arctan2(vec1.y - vec2.y, vec2.x - vec1.x));[/quote]
The calculation to find the angle from one point to another is made simple with the angle() function in c2. So to get the angle from the player to the enemy the expression would be:
angle(player.x, player.y, enemy.x, enemy.y)

I take it you want a "knockback" like collision response. With a quick search I found:

In my opinion it's not necessary to utilize the SDK unless there is something that you can't do with events. One typical situation that comes to mind is the need to interface with an outside library of some kind. Another reason could be to assist in some graphic effect that you can't do with existing plugins. However outside of that you can do pretty much anything in events.
Posts: 5,234
Reputation: 67,754

Return to How do I....?

Who is online

Users browsing this forum: blissfulwizard, DevinMurray, wizdigitech and 13 guests