Page 1 of 1

checking by a pixel??? or something.....

PostPosted: Sat Oct 23, 2010 7:57 am
by amanuob
Ummm can anybody help me XD...
I would like to know if there is a way to find out if a certain place/pixel in the screen is available or passable for a pixel character to go to.???

░░░░░░░ like this=> checks if place or directory is clear then
■░░░░░█
░░███████
██████████

░░░░░░░moves
░░░░░■ █ ___and the character only moves in his own parameter like
░░███████
██████████

▓▓▓▓▓▓▓___I was planning to make my own way of moving into rough terrain with minimum or no use of physical response.
▓▒▒▒▒▒▓
▓▒░░░▒▓
▓▒░ ■░▒▓
▓▒░░░▒▓
▓▒▒▒▒▒▓
▓▓▓▓▓▓▓

I tried to make multiple pixel Actors but it turned out to be a bit laggy, and imagine using this method with mutiple characters its a nightmare... XD

so do you think its posible????
Thanx in adavnce XD...

Re: checking by a pixel??? or something.....

PostPosted: Sat Oct 23, 2010 12:04 pm
by DarkParadox
You can use collisionfree() for this exact purpose.
Here is its definition from the script reference.:
CollisionFree: Check if position (x, y) is collision free for ActorName. Return 1 if not collide, 0 otherwise.

Code: Select all
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:
Code: Select all
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.

Re: checking by a pixel??? or something.....

PostPosted: Sat Oct 23, 2010 1:43 pm
by poopbrigade
Ahh!! XD was wondering what was that command for (סּ,סּ).....

so when I set actor name to ground?
and ground is no where to be found
my actor will move down???

..is this found in the GE tutorial??? (>,<)...

Thanx by the way XD...
PLUS++++ XD really saved my time with this code

Re: checking by a pixel??? or something.....

PostPosted: Sat Oct 23, 2010 2:55 pm
by DarkParadox
You set the actor name to the actor going to be colliding.
e.g. checking if the player is going to collide, actor name would be player.

Re: checking by a pixel??? or something.....

PostPosted: Sun Oct 24, 2010 12:08 am
by amanuob
Yeah! XD thanx alotTT!!
+++ point...
Thanks by a million folds XD....