Stopping an object

Talk about making games.

Stopping an object

Postby Murd-Machine[_] » Wed Jul 26, 2006 10:31 pm

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!
User avatar
Murd-Machine[_]
 
Posts: 72
Joined: Fri Nov 04, 2005 7:04 pm
Location: Moscow-city
Score: 1 Give a positive score

Postby makslane » Thu Jul 27, 2006 2:20 am

Why you can't use the CollisionFree function?
http://game-editor.com/docs/script_refe ... lisionfree
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Murd-Machine[_] » Thu Jul 27, 2006 10:23 am

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.
User avatar
Murd-Machine[_]
 
Posts: 72
Joined: Fri Nov 04, 2005 7:04 pm
Location: Moscow-city
Score: 1 Give a positive score

Postby Murd-Machine[_] » Thu Jul 27, 2006 9:02 pm

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]
User avatar
Murd-Machine[_]
 
Posts: 72
Joined: Fri Nov 04, 2005 7:04 pm
Location: Moscow-city
Score: 1 Give a positive score

Postby makslane » Thu Jul 27, 2006 11:39 pm

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.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Murd-Machine[_] » Fri Jul 28, 2006 9:10 pm

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.
User avatar
Murd-Machine[_]
 
Posts: 72
Joined: Fri Nov 04, 2005 7:04 pm
Location: Moscow-city
Score: 1 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron