detecting collision points

Game Editor comments and discussion.

detecting collision points

Postby ayotot » Mon Nov 19, 2007 5:28 pm

Hi all
(maybe I should've posted this in advanced topics??? :wink: )

Is there a variable which defines the collision side with which the player collides?
see the screenie and realize what I mean:
turning goomba.jpg


now, when the goomba goes round the loop, it should turn.
I got the animation, I know about animpos and stuff like that.
spinninggoomba.gif
spinninggoomba.gif (55.05 KiB) Viewed 721 times



Please, could somebody give me a script example or a turtorial?
Help would be appriceated and awarded with 1 point.
User avatar
ayotot
 
Posts: 19
Joined: Tue May 29, 2007 6:51 pm
Score: 0 Give a positive score

Re: detecting collision points

Postby pixelpoop » Mon Nov 19, 2007 7:26 pm

You can determine the side of collision but I don't think it is accurate enough for what you want to do. I think it only does left, right, top and bottom.

What I would do is make each circular path its own graphic or make an invisible actor in the center of the loop. Then you can calculate the direction from the center to the mushroom guy and use that angle to assign the proper animation to the mushroom. This can get weird looking though if your loops are ovals rather then circles.

It would be something like:
animpos=direction(center.x, center.y, mushroom.x, mushroom.y)/20;

The 20 is if your animation has 18 frames. (360 possible degrees, divided by the total animation positions(18 is this case) is equal to 20.)
Also since zero degrees is directly right, you have to start your animation with the characters feet facing right.(i think)

Also you could do this with ovals, you would just have to set up multiple centers for each loop and that would get tricky fast.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Re: detecting collision points

Postby kyensoftware » Tue Nov 20, 2007 5:00 am

Just set it so if it hits left increase animpos to the left(clockwise??)direction.
P.S. Im BAAAAAAACK! I never had a virus, just a crappy mouse. Im a dumbass :roll: :cry: :wink: :mrgreen:
Games for Windows, Linux, and PPC
Bin dosnt stand for "Binary";
it stands for Bin.
You know, where the junk goes...
User avatar
kyensoftware
 
Posts: 198
Joined: Thu Oct 26, 2006 7:49 am
Score: 5 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron