if(CollisionFree("TILES" ,x - 2,y) == false) x -= 0;

You must understand the Game Editor concepts, before post here.

if(CollisionFree("TILES" ,x - 2,y) == false) x -= 0;

Postby equinox » Tue Feb 05, 2008 5:23 pm

Hi at all,

I dont undestand the "if(CollisionFree(....)",,

In my code-->

in script editor-->MAN--> press S for left
{
if(CollisionFree("TILES" ,x - 2,y) == false) x -= 0;
}

I wish that the my MEN collides always with the ACTORS i created--> TILES and when collides the MEN stop...but my code dosent work.

PLEASE: someone can help me with my code?

Tnk1000.
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

...

Postby DarkParadox » Wed Feb 06, 2008 5:47 pm

collisionfree function can NOT used in a if function.
collisionfree is made to MAKE the actor collide or stop colliding with the corrisponding actor(the actor you set in the function)
or you might want to try(!this may not work![untested]!!)

if(CollisionFree("TILES" ,x - 2,y) == 0) x -= 0;
instead of:
if(CollisionFree("TILES" ,x - 2,y) == false) x -= 0;
P.S.
use 1 for true
User avatar
DarkParadox
 
Posts: 457
Joined: Mon Jan 08, 2007 11:32 pm
Location: USA, Florida.
Score: 84 Give a positive score

Re: ...

Postby makslane » Wed Feb 06, 2008 5:55 pm

diormeh wrote:collisionfree function can NOT used in a if function


Read here:
http://game-editor.com/docs/script_refe ... lisionfree
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: if(CollisionFree("TILES" ,x - 2,y) == false) x -= 0;

Postby equinox » Wed Feb 06, 2008 7:27 pm

Hi diormeh ,

Tnk for reply, but your code not work.
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: if(CollisionFree("TILES" ,x - 2,y) == false) x -= 0;

Postby DarkParadox » Wed Feb 06, 2008 7:29 pm

sorry bout that,(i was wrong)
ya i found something in the script reference you might like:

CollisionFree: Check if position (x, y) is collision free for ActorName. Return 1 if not collide, 0 otherwise.
int CollisionFree(char *actorName, int x, int y)
Actor name:
- "Event Actor": Actor that is receiving the current event.
- "Parent Actor": Event Actor's parent, if exists.
- "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action.
- "Collide Actor": Actor that collided with the event Actor.
- Any Actor in game.

Script Editor Syntax:
if (CollisionFree("Event Actor", x, y+5)) y=y+5; //On KeyDown Event script for KEY_DOWN, check if there is no collision before moving an actor down by 5 pixels.
User avatar
DarkParadox
 
Posts: 457
Joined: Mon Jan 08, 2007 11:32 pm
Location: USA, Florida.
Score: 84 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest