Page 1 of 1

Stopping an object

PostPosted: Wed Jul 26, 2006 10:31 pm
by Murd-Machine[_]
I have an actor that moves with moveto on 2 pixels.
How do I stop it if:
when using phisical response it bounces a little,
I have a background so I can't check if place is free.
In short I need a function to determine if there is an object e.g. "wall" in a position e.g. "player.x+2".
Help someone!

PostPosted: Thu Jul 27, 2006 2:20 am
by makslane
Why you can't use the CollisionFree function?
http://game-editor.com/docs/script_refe ... lisionfree

PostPosted: Thu Jul 27, 2006 10:23 am
by Murd-Machine[_]
It doesn't work, probaably, because I have an infinite background and extended HUD. I guess the only way to do it is to check if actor stands on the position.

PostPosted: Thu Jul 27, 2006 9:02 pm
by Murd-Machine[_]
Well, I'll try to explain more clearly what I want to do:
1. I've made 4-way movement with "move to"
2. I have a background made with infinite texture
3. Tiles size is 32x32
||
1. I need to check if there is no wall on the way I move to
Like GM:

if (instance_position(x+2,y,wall)!=1) then x+=2;

I need to make this in GE or find some alternative.[/code]

PostPosted: Thu Jul 27, 2006 11:39 pm
by makslane
Infinite actors don't are affected by collisions.
So, the CollisionFree function don't will take account infinite actors.

If the actor is not infinite or is infinite in only one axis, you can use the 'Collision State' action in a 'Create Actor' event to disable the collision tests with this actor.

You can use some thing like this:

Code: Select all
if(CollisionFree("player", x, y+5)) y=y+5;


Look the sample:
http://game-editor.com/examples/collisionfree.zip

The problem the function will return false if there are collision with any actor and the player actor.

PostPosted: Fri Jul 28, 2006 9:10 pm
by Murd-Machine[_]
I've finally worked out why is Collision Free not working.
I don't know why, but Disabling collision state doesn't work. I'm using GE 1.3.3 and put it in Create Actor event of player.