What is collision free, and how do I use it?

Non-platform specific questions.

What is collision free, and how do I use it?

Postby Hblade » Tue May 29, 2012 3:56 pm

Title says all :3
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: What is collision free, and how do I use it?

Postby skydereign » Tue May 29, 2012 4:03 pm

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.

That is pulled from the script reference. It explains exactly what it is, and even has an example of how to use it. If you have further questions about it, do ask.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: What is collision free, and how do I use it?

Postby Hblade » Tue May 29, 2012 4:11 pm

Ahh thanks! So basically if done right you can have precise control of when the actor is colliding... This is perfect for basic movement systems and moreso for advanced!
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: What is collision free, and how do I use it?

Postby skydereign » Tue May 29, 2012 4:14 pm

I assume you've read a bit of Game A Gogo's perfect collision demo's topic. There are some rather annoying problems with using CollisionFree. So while it is good for simple movement systems, more advanced games will often run into this problem. There are some cheap fixes you can use, but none of them are that great. You can use a similar system with just using collision actors that doesn't run into the problems.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: What is collision free, and how do I use it?

Postby Hblade » Tue May 29, 2012 4:18 pm

Yeah thats where I got this from. and oh. Thanks :)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: What is collision free, and how do I use it?

Postby SuperSonic » Tue May 29, 2012 9:41 pm

Does collision free check to see if there are any actors at x, y or does it just check if there are any collision actors at x, y? :)
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: What is collision free, and how do I use it?

Postby skydereign » Tue May 29, 2012 10:30 pm

It checks if the actor would collide if moved to xy.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: What is collision free, and how do I use it?

Postby SuperSonic » Tue May 29, 2012 10:34 pm

And by collide you mean physical response? Or a collision event? :)
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: What is collision free, and how do I use it?

Postby skydereign » Tue May 29, 2012 10:41 pm

It'd be easy to find out. But... it means colliding, as in the sprites intersect and would cause a collision event if there was a collision between the actors (but the collision event isn't necessary, just the CollisionState can't be disabled).
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: What is collision free, and how do I use it?

Postby SuperSonic » Tue May 29, 2012 11:04 pm

Sweet! Thank you :D
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron