Jump to content


Photo
* * * * * 1 votes

Pixel Perfect Collisions V4.0


  • Please log in to reply
49 replies to this topic

#1 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 31 March 2008 - 12:10 AM

Replies to topics in this forum are held to a high standard. Reviews must have a critique or suggestion for use to be approved. Read the rules here.


  • Title - Rixeno's Pixel Perfect Collision Engine
  • Tutorial Description - Easy solution to pixel perfect collisions for objects against solid objects with sliding.
  • Game Maker Version - GM6 :D
  • Registration Requirements - Registered (because of the bullet code, the image blend and the motion planning)
  • File Type - .gm6
  • Direct Link - BOX.net (DOWNLOAD)
  • Direct Link - BOX.net (DOWNLOAD) - This version was made by Flexaplex and requires GM7
  • Filesize - 14.5kb
Additional Information:
My Pixel Perfect Collision Example uses a simple concept of checking each pixel in front of the object and making the object move as close as it can to that point, whether it includes sliding or not.

Features:
  • Top-Down collisions
  • Bullet collisions
  • Isometric Collisions (NEW!)
  • Smooth Collisions (like Sliding)
  • General collision script (which offers an infinite amount of possibilities, available here: move_step())
Crediting:
Credit isn't required, but very well appreciated. And a special thanks to "headline@live.se" for helping me with the sliding and a big thanks to "Flexaplex" for creating a general script using this engine which led to tds collisions and is now also used for the new isometric example.

Edited by Rixeno, 05 September 2009 - 02:19 AM.

  • 2
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#2 xot

xot

    GMC Dismember

  • GMC Elder
  • 4785 posts
  • Version:GM:Studio

Posted 31 March 2008 - 07:06 PM

This is very simple, but it is clean and it works and will drop right into many games.

Simple ways that you can change the behavior:

* Change "place_free()" to "place_empty()" to have it check for collisions against solid or non-solid objects.

* Change "place_free()" to "not place_meeting(<x>,<y>,object)" to have it check for collisions with a specific object or instance.
  • 0
GMLscripts.com, rise from your grave!

If any of my posts contain broken images or links, I can probably supply them for you. PM with a link to the post.

#3 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 01 April 2008 - 08:21 PM

Good idea... I'll try to get strait to it :(

EDIT: I just finished adding that last night, so it's up and running as the new download :blink:

Edited by Rixeno, 02 April 2008 - 08:55 PM.

  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#4 DJ Motion

DJ Motion

    GMC Member

  • GMC Member
  • 229 posts

Posted 06 April 2008 - 07:35 PM

The example is good and clean. But the funny thing is that this peace of code intrested me more then the main example.

draw_text(36,36,"FPS: "+string(fps)+"/"+string(room_speed));

Thnx allot for that!
  • 0

#5 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 08 April 2008 - 09:16 PM

There's a new update, there is now smooth movement, help provided from "headline@live.se". If you would like anything else added, please request or PM
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#6 Reegan

Reegan

    GMC Member

  • New Member
  • 463 posts

Posted 10 April 2008 - 05:24 PM

Theres a bug; when moving diagonally and your collide into a block the character gets stuck 1 pixel away from the block
Other that that i found no other reason why this wouldnt be useful to the noobs lol.

All though i still prefer my way <_<
  • 0
~The Game Making Perfectionist - Perfection is my religion~

#7 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 10 April 2008 - 07:34 PM

@ Reegan : Yeah, I saw that yesterday or the day before and realized that it wasn't really pixel perfect anymore, so I found a way to fix this bug. I just uploaded a new version on BOX.net with the bug fix.

If you'd like to see anything else added PM me. I'll try to add some new scripts for TDS pixel perfect movement and maybe others, to make a "true" pixel perfect collision engine for many kinds of games <_<
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#8 sHarivaRi

sHarivaRi

    GMC Member

  • New Member
  • 25 posts

Posted 10 April 2008 - 08:47 PM

seems to be a good example.. but i've got one problem

i used your example in my new game, a race game.. und well, after including the scripts and codes.. my car cant drive straight ahead, or to the left, right or back. it always drives in curves and the direction of the sprite isn the same direction i drive.. that looks weird

can you (or someone else) please help me.. it's realy important because i didn't found another good working collision example... thanks guys

greetz sharivari
  • 0

#9 Reegan

Reegan

    GMC Member

  • New Member
  • 463 posts

Posted 11 April 2008 - 07:40 AM

I'll try to add some new scripts for TDS pixel perfect movement and maybe others, to make a "true" pixel perfect collision engine for many kinds of games ;)


unfortunatly for you ive already achieved this lol, just waiting for the mods to approve my topic :)
glad to know you have figured out the bug congratz! :P
  • 0
~The Game Making Perfectionist - Perfection is my religion~

#10 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 11 April 2008 - 06:55 PM

It seems like you would need some sort of Top-down collision engine that moves in the direction of the vehicle. If I'm correct, then you're somewhat in luck. At the moment, I'm working on an addition to the engine to add that kind of collision system to further enhance the overall engine. It's going to be a little like a TDS for now, but I can try and make a car-like engine as a little extra.

P.S: This may take a while because I'm going to be gone for the week-end, and I don't have much time during the week, but I'll try to get this done as soon as possible :)
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#11 titis_94@hotmail.com

titis_94@hotmail.com

    GMC Member

  • New Member
  • 98 posts

Posted 13 April 2008 - 07:15 PM

Can u make this without diagonally wlaking plz?
  • 0

#12 sHarivaRi

sHarivaRi

    GMC Member

  • New Member
  • 25 posts

Posted 17 April 2008 - 10:01 PM

It seems like you would need some sort of Top-down collision engine that moves in the direction of the vehicle. If I'm correct, then you're somewhat in luck. At the moment, I'm working on an addition to the engine to add that kind of collision system to further enhance the overall engine. It's going to be a little like a TDS for now, but I can try and make a car-like engine as a little extra.

P.S: This may take a while because I'm going to be gone for the week-end, and I don't have much time during the week, but I'll try to get this done as soon as possible :)


mhh.. okay i understand. i would do it by myself.. but i'm an gml n00bi.. ;)
but thanks - i'll be waiting here... ;)
  • 0

#13 TonyBase

TonyBase

    GMC Member

  • GMC Member
  • 143 posts

Posted 18 April 2008 - 03:31 AM

Hmmm... Well, I found some small problems with irregular terrain, but the quadrilateral collisions are perfect.

The problem I found with irregular is when you diagnolly walk into an edge with said irregular terrain, and attempt to walk into it while trying to hug the wall. It's a problem that might come up as people casually play the game.
  • 0

#14 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 19 April 2008 - 09:10 PM

@TonyBase: I'm not quite sure what you mean by this. I checked the diagonal collisions and they seem to be working fine... Although I'm not sure if this is it, I did find that if you're trying to move up the slope (moving by the right for example) while pressing down, the object stays with the slope, but that's what it's supposed to do. Once again, I didn't really understand what you meant by that.
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#15 Daemon

Daemon

    GMC Member

  • New Member
  • 5 posts

Posted 20 April 2008 - 08:23 AM

Can one apply this engine to bullets that move to all directions (360 degrees)? If it's possible, how?
  • 0

#16 Robbi

Robbi

    GMC Member

  • New Member
  • 107 posts

Posted 22 April 2008 - 01:46 AM

;) it doesn't work with ord commands... now if im wrong and maybe just doing it incorrectly please correct me, other wise please correct this.

here's what i put
rppc_step_solid(3,ord('w'),ord('s'),ord('a'),ord('d'));

  • 0

G-Save Best Pause System Health Bar Containers

Proudly Canadian My Mediafire Public Directory Proudly Canadian

#17 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 22 April 2008 - 11:04 PM

@ Grabnar: The ord() function is case-sensitive, so you have to put then in CAPS. So your code would be:
rppc_step_solid(3,ord('W'),ord('S'),ord('A'),ord('S'));
@Daemon: You could use some code like this for the movement
var i;
if (keyboard_check(argument1))
	for (i=argument0;i>=0;i-=1)
	{
		if (place_free(x,y-i))
			y-=i;
			else
				{
				if (place_free(x-i,y-i))
					x-=i/2;
				if (place_free(x+i,y-i))
					x+=i/2;
				}
		if (!place_free(x,y-1))
			instance_destroy(); //Or whatever else you want
	}
if (keyboard_check(argument2))
	for (i=argument0;i>=0;i-=1)
	{
		if (place_free(x,y+i))
			y+=i;
			else
				{
				if (place_free(x-i,y+i))
					x-=i/2;
				if (place_free(x+i,y+i))
					x+=i/2;
				}
		if (!place_free(x,y+1))
				instance_destroy();
	}
if (keyboard_check(argument3))
	for (i=argument0;i>=0;i-=1)
	{
		if (place_free(x-i,y))
			x-=i;
			else
				{
				if (place_free(x-i,y-i))
					y-=i/2;
				if (place_free(x-i,y+i))
					y+=i/2;
				}
		if (!place_free(x-1,y))
				instance_destroy();
	}
if (keyboard_check(argument4))
	for (i=argument0;i>=0;i-=1)
	{
		if (place_free(x+i,y))
			x+=i;
			else
				{
				if (place_free(x+i,y-i))
					y-=i/2;
				if (place_free(x+i,y+i))
					y+=i/2;
				}
		if (!place_free(x+1,y))
				instance_destroy();
	}
That should do the trick <_<

EDIT: That's if you want it to move, I currently working on something like that for directional movement, the example for now will include a bullet.

Edited by Rixeno, 23 April 2008 - 08:04 PM.

  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#18 flexaplex

flexaplex

    GMC Member

  • Global Moderators
  • 4814 posts
  • Version:GM8

Posted 24 April 2008 - 02:06 AM

Congradulations. I have looked at pretty much every TD collision script that has been made and not been happy with any of them until now. It's such a simply script as well I can see why it works so well.

I will be looking into improving this script myself.. I can think of few things already, it might be quite a while before I actually do so though. Please PM me if you make any updates yourself.

I'm pretty happy with this, it's about time someone came up with something that works well ::lmao::

Edited by flexaplex, 26 April 2008 - 05:09 PM.

  • 0
:]

#19 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 25 April 2008 - 09:13 PM

Yay, I've just released a new version with the bullet, you can now shoot bullets which land correctly against the walls from any direction. The bullets basically move until they can't, once they can't move anymore, it returns "true" meaning that there's a collision. I'll be adding this same function for the rest to return a collision true/false. Next version should either have some sort of isometric movement, tds movement, or perhaps platform, it depends what I finish first. Enjoy :)

BTW, to shoot bullets, left click will shoot one at a time while right click will create a series of bullets.

EDIT: Thanks flexaplex, I'm glad you like the engine :P

Edited by Rixeno, 27 April 2008 - 12:42 PM.

  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#20 headline@live.se

headline@live.se

    GMC Member

  • New Member
  • 1298 posts

Posted 27 April 2008 - 07:21 AM

i love yor smiley in the "game"! i dont know why :GM073: it just makes me laught!
  • 0
92% of the population has moved to Rap. If you are one of the 8% that has stuck to rock, put this in your sig. RAP SUCKS!

keyboard_get_keyname

#21 karzahnii

karzahnii

    GMC Member

  • New Member
  • 545 posts

Posted 27 April 2008 - 06:27 PM

You actually do need registered, for the bullet...good work, anyways.
  • 0

#22 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 29 April 2008 - 08:30 PM

Yeah, but if you don't use the bullet (which was just added last week), it's unregistered, I'll edit the first post and idicate that, thanks for pointing that out. ^_^
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#23 Jarige

Jarige

    GMC Member

  • New Member
  • 15 posts

Posted 12 May 2008 - 12:07 PM

This is a great example, and great code, but I guess move_contact_solid (or move_contact_all) is almost the same as this. Problem with both your script and move_contact, is that it doesn't work with move_bounce. If you change the piece of script where you let the bullet disapear to
move_bounce_solid
It will not bounce of the wall.
Do you (or anyone) know what the problem is?
  • 0

#24 NEED HELP sorta

NEED HELP sorta

    GMC Member

  • New Member
  • 1501 posts

Posted 14 May 2008 - 09:05 AM

I assumed that the bullet wouldn't bounce because it doesn't actually have speed, upon looking my suspicion was confirmed.
That aside you basically fix it by setting the speed to '1' then using the bounce code then setting the speed to '0' again.
That should correct the problem, but be sure that the code doesn't stop the object by setting a variable called say 'collision' to true.

Anyway, these are great, very smooth, collisions.

Edited by NEED HELP sorta, 25 June 2008 - 01:42 AM.

  • 0
http://img159.images...025/scr1ea8.png
http://img374.images...944/scr2hf6.png
Alagaesia Online - Not yet released.

You can bring the release date closer, by helping at the following topics:
Intro Narration
Music Topic

#25 Astrosapien

Astrosapien

    GMC Member

  • New Member
  • 473 posts

Posted 17 May 2008 - 12:42 PM

Fantastic! Only problem is it will not work unless you are pressing one of the keys. Thus, it won't work with gravity or if something pushes you. Is it possible for you to use vspeed and hspeed instead of cheacking if the key is pressed?
  • 0
I am no longer available for your team. Please stop PMing me.

#26 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 18 May 2008 - 11:28 PM

Well, of all the things I've been working on, adding some different functions to this has been a lower priority, but once I get back to work on it, I'll make a script that can maybe be used for all those things... As a matter of fact, I might be able to make a quick version, I'll post the new download link on the main post with the "advanced" part :)
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#27 brendo

brendo

    GMC Member

  • New Member
  • 30 posts

Posted 02 June 2008 - 09:57 AM

[color="gray"]* Direct Link - BOX.net (DOWNLOAD)
* Filesize - 14.5kb
*


My virus protection tells me this link contains Malware.
  • 0
I haven't lost my mind; I have a tape back-up somewhere

Registered GM 7 user

#28 Solidus

Solidus

    GMC Member

  • GMC Member
  • 556 posts
  • Version:GM:Studio

Posted 14 June 2008 - 06:53 AM

[color="gray"]* Direct Link - BOX.net (DOWNLOAD)
* Filesize - 14.5kb
*


My virus protection tells me this link contains Malware.


It doesn't.

Also, when I try to change the pixel speed arguement to a variable (such as vspd, *not to be confused with vspeed*) it comes up with this error:


___________________________________________
ERROR in
action number 1
of Step Event
for object object0:

Error in code at line 4:
if (collision==true)

at position 17: Cannot compare arguments.
___________________________________________

When I put it back to a number, it works just as it should, except I'm using this on a platformer and the gravity is constantly changing.
  • 0

#29 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 14 June 2008 - 03:37 PM

I don't know what's wrong with your AV because I haven't had that error, nor has other people. I think there was a topic about this happening the Community Forum some time ago, maybe it might answer what's wrong...
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#30 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 26 June 2008 - 07:13 PM

Flexaplex just PMed me with a great re-build of this engine. I found a small "bug" in the first room, but the TDS movement was phenomenal! Absoloutely amazing! So this is just to mention that there are now two versions of the collision example available:
- The Original Top-Down
- Flexaplex's Edited Top-Down-Shooter (TDS)

Enjoy, and a big thanks to Flexaplex :D

I just added Flexaplex's edited script to the original example with a new room for Top-Down Shooter collisions.

@Solidus: I don't see anything wrong considering that your "if (collision==true)" isn't even part of my script. Did you define the variable "collision" before comparing it, because if you forgot to define "collision", it will give you an error like that...

Next update will hopefully have some more types of collisions if possible and some bug fixes if anyone finds any :D
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#31 flexaplex

flexaplex

    GMC Member

  • Global Moderators
  • 4814 posts
  • Version:GM8

Posted 02 July 2008 - 08:13 PM

Thanks for posting my editted version Rixeno. I think I'll now ask in advanced q&a about the rotating masks problem (in the 4th room).. I know it's a problem that has come up a couple times, but I haven't seen a solution I think is good enough yet.

edit: the rotation problem is slowly being solved by me. When it is solved I think I will release the engine seperately as it will then be encorporating a lot of different scripts by people as well as myself who should be creditted seperately really.

Edited by flexaplex, 08 July 2008 - 04:28 PM.

  • 0
:]

#32 mike ←

mike ←

    GMC Member

  • New Member
  • 94 posts

Posted 02 July 2008 - 10:17 PM

It's good, but it does not check when your not moving, so you can rotate right into a wall, but other then that, it's pretty good.
  • 0

#33 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 09 July 2008 - 07:18 PM

Before the doing the rotations, you can check if it's free, like:
if (place_free(x,y))
	direction+=5;
I think that should work :whistle:
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#34 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 05 September 2009 - 01:17 AM

Wow, it's been a long time since the last post, but I decided to add a simple isometric example for those who want some good collision for their isometric games. So yeah, the new update includes isometric movement with both a controlled object (using the move_step() script) and an uncontrolled object (using the simple mp_potential_step() function included with Game Maker). If you have any questions or any requests for future versions, please post it (with some additional feedback for the rules' sake) or PM me.
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#35 shirleytravis

shirleytravis

    GMC Member

  • New Member
  • 1 posts

Posted 10 November 2009 - 11:29 AM

I assumed that the bullet wouldn't bounce because it doesn't actually have speed, upon looking my suspicion was confirmed.
That aside you basically fix it by setting the speed to '1' then using the bounce code then setting the speed to '0' again.


regards,
shirley
Simulation prêt
  • 0

#36 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 11 November 2009 - 04:00 AM

@ robert3dg: I'm pretty sure if you replace the place_meeting with place_free, it'll check for any solid object, which is simpler than using a single solid_parent.
@shirleytravis: I'm sorry, but I'm not too sure what you're talking about. A bullet does have speed, otherwise it wouldn't move :P
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#37 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 16 November 2009 - 04:26 AM

Alright, so I'm thinking that for the player, you have a solid_par, where the walls and furniture are parents of, but for the bullet, you make it an individual object collision, for say the wall. Even if the wall is parented with solid_par as is the furniture, the bullet will pass over the furniture since it's only told to collide with the wall object. And if you want more objects for the bullet to collide with, make objects parents of the wall object, which in turn would also be parents of solid_par when used for the player. I hope this made sense for you robert3dg.
-Rixeno
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#38 petenka

petenka

    The Chosen One

  • New Member
  • 911 posts

Posted 17 November 2009 - 04:16 PM

Or you could have this parenting structure
solid_par
from which branches high_par and low_par
high_par will parent all walls which nothing goes through
low_par will parent everything which bullets and vision can pass over
when handling collisions it'll be done with solid_par
but when handling vision and bullets it'll be done with high_par
Enjoy.
  • 0
My Stuff:
Attack of the Jelly - A game about (oh, the horror) strawberry jelly!
Math Based Platformer Engine - The best physics for a platformer, ever.
Realtime Dynamic Fog - For realistic environmental effects.
Windy Snow - The best snow in all of gmc.
My Hate List:
Kubanen, Alex4Red, johnjoe

#39 sargunster

sargunster

    GMC Member

  • GMC Member
  • 451 posts

Posted 29 November 2009 - 04:29 AM

What changes does the version made by flexaplex have?
  • 0

#40 aKtimelli

aKtimelli

    GMC Member

  • GMC Member
  • 74 posts
  • Version:GM:Studio

Posted 19 February 2010 - 12:41 PM

Is there any way to implement gravity into this engine? It would be really cool.

Otherwise, nice engine.

Edited by aKtimelli, 19 February 2010 - 12:41 PM.

  • 0

vbqpTzU.png

         Finnish Indie Studio Shellbash - shellbash.ddns.net


#41 borut

borut

    Courage Wolf Productions

  • GMC Member
  • 1457 posts
  • Version:GM:Studio

Posted 19 February 2010 - 02:28 PM

awesome example. I'll use it!
  • 0

#42 anselm

anselm

    GMC Member

  • GMC Member
  • 239 posts

Posted 22 February 2010 - 12:18 AM

Ah. Thanks a ton for this! This saved me lol. I couldn't get the walls to work as precise as I wanted them to
  • 0

#43 Mad_Scientist

Mad_Scientist

    GMC Member

  • New Member
  • 79 posts

Posted 27 June 2010 - 06:59 PM

In the ISOMETRIC, can you fix it so that it "snaps" to the grid square where the mouse was clicked?

Usually it stands crossing over the lines.

Thanks.

Edit:
Also, in ISO view, if we click on the LEFT of the top-left GREEN obj_cylinder_iso, the obj_player keeps circling it forever.

Edit: Actually, if you click CLOSE to any obstacle, since the obj_player is NOT snapping to grid, it runs around that obstacle infinitely. So in essence, snap to grid is missing! :P

Edited by Mad_Scientist, 27 June 2010 - 07:07 PM.

  • 0

#44 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 19 September 2010 - 06:51 PM

In the ISOMETRIC, can you fix it so that it "snaps" to the grid square where the mouse was clicked?

Usually it stands crossing over the lines.

Thanks.

Edit:
Also, in ISO view, if we click on the LEFT of the top-left GREEN obj_cylinder_iso, the obj_player keeps circling it forever.

Edit: Actually, if you click CLOSE to any obstacle, since the obj_player is NOT snapping to grid, it runs around that obstacle infinitely. So in essence, snap to grid is missing! :P


I don't see the point to putting the grid snapping, cause then you wouldn't need a collision script like the one in my engine, it would not make any sense. You could definitely find a more effective way to move around while being snapped to the grid with a simpler collision detection system, since you only have to check the grid you want to go in, not every pixel. As for the player circling around forever if you click on an obstacle, as I stated before, there is no point to add a function to stop it from doing so since it's not part of this collision engine. Sorry about that,
-Rixeno
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#45 Wazaq

Wazaq

    GMC Member

  • New Member
  • 6 posts

Posted 03 November 2010 - 05:24 AM

This is a awesome engine, When i tested it from the file above it worked exactly as I wanted. However when I tried to use the script and the step code with my player on my game, it won't detect the walls and I cannot figure out why.

I am using GM8 Pro. I'm not getting any errors, and I copied the script codes exactly as in the gmk.

EDIT: I'm not sure why, but i got it to work with the 1st file and not the 2nd one. Not sure why it made a difference though because the 2nd file was basic it seemed.

Edited by Wazaq, 03 November 2010 - 05:40 AM.

  • 0

#46 MegasGamer

MegasGamer

    GMC Member

  • New Member
  • 84 posts

Posted 10 November 2010 - 08:17 PM

Does this engine also account for making a character move up and down slopes?
  • 0

#47 Ruub

Ruub

    Finn The Human

  • GMC Member
  • 762 posts
  • Version:GM:Studio

Posted 14 December 2010 - 02:41 PM

hey there!

I tried it out and It's quite fancy ;D

though I hoped using the bullet collision way of life, it didn't work for me
My game uses 1 pixel thin lines which which your bullet go straight through! huh!

If you care enough to give any suggestions, pm me please :)

Edited by Ruub, 14 December 2010 - 02:42 PM.

  • 0

#48 _174413

_174413

    GMC Member

  • New Member
  • 22 posts
  • Version:GM8

Posted 07 April 2011 - 12:13 AM

Hey there. I've been studying the code in your example and am a novice GML user trying to learn more about the language.

Could someone explain what the 'argumentx' is in the move_step script?
  • 0

#49 _174413

_174413

    GMC Member

  • New Member
  • 22 posts
  • Version:GM8

Posted 07 April 2011 - 09:00 AM

Hey there. I've been studying the code in your example and am a novice GML user trying to learn more about the language.

Could someone explain what the 'argumentx' is in the move_step script?


Or at least, could someone direct me to a topic which covers scripts extensively enough for me to learn more?
  • 0

#50 Rhuidean

Rhuidean

    GMC Member

  • New Member
  • 1 posts

Posted 08 April 2011 - 10:20 AM

I tried this out for my little tank game, but im having some issues getting this working on the tank itself.
It works perfectly on the bullets the tank fire, but the tank either moves on its own and stops when it hits a solid, or let me move it and just pass trough all solids.
Not sure what im doing wrong, so any help would be greatly appreciated. :)

Here's the movement code i use for the tank if its any help.

if (keyboard_check(ord('A'))) { direction += 5; }
if (keyboard_check(ord('D'))) { direction -= 5; }
image_angle = direction;

if (keyboard_check(ord('W'))) {
    friction = 0; 
    if (speed < 6) {
        speed += 0.3;
    }
}

if (keyboard_check(ord('S'))) {
    friction = 0; 
    if (speed > -6) {
        speed -= 0.3;
    }
}

if (!keyboard_check(ord('W')) && !keyboard_check(ord('S'))) {
    friction = 0.3;
}


- Rhuidean

Edited by Rhuidean, 08 April 2011 - 10:21 AM.

  • 0