PDA

View Full Version : fixing a barrier


TheAngryAlterEgo
10-03-2006, 07:40 PM
I'm working on a game for a final project and I need to stop the player from moving through buildings and other items. I tested a working code that makes the player move away from an object when he gets too close in a new world and got it to work, but when I added the code to my game, the player moves either below the ground or above the objects when he gets near them.
The only difference between the codes is that in the new world I had the player moving at a certain speed while in the game he moves forward 1 meter at a time while the legs move to make the walking realistic. This doesn't seem to make a difference either way however.

http://show.imagehosting.us/show/1647272/0/nouser_1647/T1_-1_1647272.PNG (http://www.imagehosting.us/index.php?action=show&ident=1647272)
This method is brought into another method where it is copied for every object on the screen and put into a Do Together.
http://show.imagehosting.us/show/1647267/0/nouser_1647/T1_-1_1647267.PNG (http://www.imagehosting.us/index.php?action=show&ident=1647267)
This is the walking command for the player.

I tried replacing the current walk method with a Move at Speed method with no success. Is there any other way this problem can be fixed?

Mr Nemo
10-03-2006, 08:49 PM
Currently, I myself am still trying to perfect collisions. MY best suggestion for you is to run a search on the forum for collisions, and see if you can't find anything useful.:(

TheAngryAlterEgo
10-03-2006, 10:00 PM
I've already gone through the forum and haven't found anything that would work in this scenario unfortunatly.

Mr Nemo
10-03-2006, 10:07 PM
Then you might want to place an if else statement at the beginning of your method. Kinda like this:
IF [(Arbalest) is within (distance) meters of (Object)]
(Arbalest) turn (left) (.5) revolutions
ELSE
(Arbalest.run)

DrJim
10-04-2006, 03:01 PM
I've never tried the "move away" coupled with "as seen by world" but the line of movement is going to be along a line from the center of the object to the center of the world - can't tell where that is, or if it changed, without looking at your worlds.

Try changing the "as seen by" to the object actually moving and see if that helps.