PDA

View Full Version : ShadowMaster's Collision Code



ShadowMaster
10-06-2008, 10:03 PM
for Game Maker.

I've decided to release the collision code I've written for the movement of platformer characters. The point of the code is to lighten the burden of the developer of a platformer, while at the same time being general purpose enough to allow you do basically anything you would normally find in a platformer, for instance jump, double jump, wall cling, climbing ladders etc. You should be able to do all these things after a bit of thinking.

The script doesn't anything other than move the character at the speeds you set it at, but after a bit of thinking you should realise that this is enough to allow you do all the things characters in platformers do. To make the character walk left you just set it's x speed to a negative amount and it'll move at that speed until it hits a wall. Another helpful feature is that you can specify what height of hills it may climb and descend, making creating a character for a platformer ridiculously easy.

Here is the code plus an example of usage:
SMC (Game Maker 7 version) (http://www.gamedev.za.net/filecloset/download.php?id=492)
SMC (Game Maker 6 version) (http://www.gamedev.za.net/filecloset/download.php?id=493)

To use the code in a project just merge the file, SMC.gmk, with your current game.
No credit is required if you use the scripts but would be appreciated.



Any questions about usage just ask away and I'll help.
Any suggestions for improving the actual performance of the code, just tell and I'll do.



PS. this is the script that's being used in the competition 19 entry, Death.

Tr00jg
10-06-2008, 10:45 PM
Ah cheese. Its .gmk. My GM7 won't register. I tried to convert the key but it wont work and YoYoGames support system doesn't seem to work (douches) and I'm too lazy to put my back into it. You can't make a .gm6 version? I can't remember if its possible to convert the source back to GM6...

ShadowMaster
11-06-2008, 07:07 AM
I've uploaded a new version I hope everything is compatible, someone with GM6 should test it. I used Lateral Game Maker (http://www.ismavatar.com/lgm/) for the conversion btw.

Tr00jg
11-06-2008, 02:12 PM
Hmm... The link for both GM7 and GM6 is the same.

ShadowMaster
11-06-2008, 02:14 PM
Hmm... The link for both GM7 and GM6 is the same.

Oops... will fix now.

EDIT: Fixed.

Tr00jg
11-06-2008, 02:41 PM
Wicked! This could come in handy as I'm doing my 1st platformer. Thanks. :)

ShadowMaster
11-06-2008, 02:47 PM
Wicked! This could come in handy as I'm doing my 1st platformer. Thanks. :)

Pleasure :)

Bonezmann
11-06-2008, 04:10 PM
Does the code include gravity?

ShadowMaster
11-06-2008, 04:32 PM
Does the code include gravity?

Nope but that's really simple to add. Just add a small number to the character's Y speed every step when he's in the air. Check the example. It only takes 2 lines. :)

Bonezmann
11-06-2008, 04:36 PM
It only takes 2 lines

Really? Because the only thing I hate is that Gravity crap in GM, I never get it right. I'll go check it out tonight, thanx :)

ShadowMaster
11-06-2008, 04:43 PM
Really? Because the only thing I hate is that Gravity crap in GM, I never get it right. I'll go check it out tonight, thanx :)

Just a word of warning don't set the builtin speed and gravity variables, they WILL mess up the code. Only variables you should set to make use of the script are mSpeedX and mSpeedY, NOTHING else.

Bonezmann
11-06-2008, 04:47 PM
I'll keep that in mind, thanx :)

ShadowMaster
10-05-2009, 05:31 PM
Sorry for the major necro, but it seems I have lost my collision code during a system reinstall and with the filecloset being down I'm unable to retrieve it, so I'm wondering does someone still have it and can you send it to me?

PS. If this results in me getting my code back this will be the second time that sharing my source code has prevented it from being lost forever. :D