Open Surge Forum

A fun 2D retro platformer inspired by Sonic games and a game creation system

You are not logged in.

Announcement

Our community has moved to Discord! https://discord.gg/w8JqM7m

#1 2017-01-20 20:51:30

KZR
Member
Registered: 2010-07-14
Posts: 1,447
Website

[QUESTION] Detecting point of collision

Hi all, it's been a while smile

so I decided to pick up Open Surge again, as my engine of choice to create an arcade game.

One thing that struck me, is if it is even possible to determine the middle point of a collision, like where one object intersects the other. That I was never able to figure out, and don't even know if it is technically possible with the current API.

thoughts? roll


SD_sml.pngSeD_sml.pngLTot_W_sml.png
https://discord.gg/w8JqM7m ---> Open Surge's Discord server

Offline

#2 2017-01-21 18:52:48

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: [QUESTION] Detecting point of collision

Hi KZR, welcome back.

What do you mean, the middle point of a collision? Are you using the bounding box method? If so, it's a math problem that you can solve with the current API.

Offline

#3 2017-01-21 19:23:23

KZR
Member
Registered: 2010-07-14
Posts: 1,447
Website

Re: [QUESTION] Detecting point of collision

I mean, in an on_collision condition, is there a way to know where both objects are touching? I'm not sure what you mean with "bounding box method"


SD_sml.pngSeD_sml.pngLTot_W_sml.png
https://discord.gg/w8JqM7m ---> Open Surge's Discord server

Offline

#4 2017-01-23 02:25:06

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,300
Website

Re: [QUESTION] Detecting point of collision

on_collision doesn't inform you of that, but you can calculate the exact area by using functions like xpos() and width().

See: https://wiki.allegro.cc/index.php?title=Bounding_Box

maxresdefault.jpg

https://www.youtube.com/watch?v=8b_reDI7iPM

Offline

Board footer

Powered by FluxBB  hosted by tuxfamily.org