Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-06-2003, 12:09 AM   #1
threE deE
Registered User
Join Date: Oct 2003
Location: Brisbane, Australia
Posts: 2
Question Collision detection help

I have this code (with some help from the Maze.fla sample).
This code has been applied to the "wall" mc that moves and detects the player's mc. This works but the detection for angled edges on the walls is a bit dodgy and it moves the player back to far from the wall which makes the movement skippy. how would i fix the hittest code to get smooth close collision detection for a topdown view run around game??

ActionScript Code:
onClipEvent(enterFrame){     with (_root.player){         angle = 5         spd = 1.5                 // Move Forward         if (Key.isDown(Key.UP)){             _x += spd*Math.sin(_rotation*(Math.PI/180))             _y -= spd*Math.cos(_rotation*(Math.PI/180))         }         // Move Backward         if (Key.isDown(Key.DOWN)){             _x -= spd/2*Math.sin(_rotation*(Math.PI/180))             _y += spd/2*Math.cos(_rotation*(Math.PI/180))         }         // Turn Left         if (Key.isDown(Key.LEFT)){             _rotation -= angle         }         // Turn Right         if (Key.isDown(Key.RIGHT)){             _rotation += angle         }                 if (wallz.hitTest(getBounds(_root).xMax, _y, true)) {             _x -= spd         }         if (wallz.hitTest(getBounds(_root).xMin, _y, true)) {             _x += spd         }         if (wallz.hitTest(_x, getBounds(_root).yMax, true)) {             _y -= spd         }         if (wallz.hitTest(_x, getBounds(_root).yMin, true)) {             _y += spd         }     } }
threE deE is offline   Reply With Quote
Old 10-06-2003, 08:54 PM   #2
threE deE
Registered User
Join Date: Oct 2003
Location: Brisbane, Australia
Posts: 2

hello?? ive posted this on five forums and noone bothers to help me.
threE deE is offline   Reply With Quote
Old 10-13-2003, 11:07 AM   #3
Registered User
Alvaretto's Avatar
Join Date: Apr 2003
Location: Buenos Aires
Posts: 174

Hi, unfortunately I can´t help you as I´m a newbie but I can tell you that people here is very helpful and, if you didn´t receive any answer may be is because no one knows it.

Just be a little patient.

(if you want some collision help try to contact the argentine rugby team. Maybe they can tell you something about colliding agains aussies )
Alvaretto is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 01:43 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.