Hi,
I have been using Game Maker for some time and I've under these years become quite good at GML. So I decided to share my knowledge in a scripts thread so all of you that need help can come here and request help and look through my scripts. I'll keep all the scripts on the first post and add new as I have time and you request them. I'll only post GML coding. If there is something that you're unsure of please look for it on the GM wiki site or the official documentation before asking. All the scripts are made by me and if there is something I can't help you with I'll try to point you to a script/tutorial that does what you requested.
As for credit you can give it if you want, it is really not necessary.
If you'd like some script don't hesitate either posting in this thread or PM me if you'd like to be anonymous.
If you do a too big request I'll propably point you to another script/tutorial. I'm here to help if you got stuck on something and not for making your game for you.
You can read these scripts and do changes on them to better suit your needs and use them as a base or idea giver for your custom engines without having to credit me.
Difference between two values - Last update 100206
Movement in eight direction with pixel perfect collission - Last update 100206
Gravity - Last update 100207
Collision with floor (to be used with gravity NOT with Manual Gravity. On MG you only need to put the objects to solid!) - Last update 010207
Variable jumping - Last update 100207
Platform movement with slopes - Last update 100206
Pixel Perfect Gravity (Manual Gravity) - Last update 100403
I have been using Game Maker for some time and I've under these years become quite good at GML. So I decided to share my knowledge in a scripts thread so all of you that need help can come here and request help and look through my scripts. I'll keep all the scripts on the first post and add new as I have time and you request them. I'll only post GML coding. If there is something that you're unsure of please look for it on the GM wiki site or the official documentation before asking. All the scripts are made by me and if there is something I can't help you with I'll try to point you to a script/tutorial that does what you requested.
As for credit you can give it if you want, it is really not necessary.
If you'd like some script don't hesitate either posting in this thread or PM me if you'd like to be anonymous.
If you do a too big request I'll propably point you to another script/tutorial. I'm here to help if you got stuck on something and not for making your game for you.
You can read these scripts and do changes on them to better suit your needs and use them as a base or idea giver for your custom engines without having to credit me.
Difference between two values - Last update 100206
- //Difference between two values
- //made by Markolainen
- //Put in any event when this calculation is needed
- //argument0=value 1
- //argument1=value 2
- //Example difference=script_difference(10,-10);
- //If both positive or negative
- if sign(argument0)=sign(argument1){
- return(abs(abs(argument0)-abs(argument1)));}
- //If one is negative and the other positive
- if sign(argument0)!=sign(argument1){
- return(abs(abs(argument0)+abs(argument1)));}
Expand to see the code.
Movement in eight direction with pixel perfect collission - Last update 100206
- //8 directional movement
- //made by Markolainen
- //Put in step event for walking normally
- //argument0=speed
- //Example script_move(3);
- {
- //Declare temporary variables
- var xsp, ysp;
- //Check if buttons are pressed
- xsp=(keyboard_check(vk_right)-keyboard_check(vk_left))*argument0;
- ysp=(keyboard_check(vk_down)-keyboard_check(vk_up))*argument0;
- //Execute movement
- repeat(abs(xsp)){
- if place_free(x+sign(xsp),y) then x+=sign(xsp);}
- repeat(abs(ysp)){
- if place_free(x,y+sign(ysp)) then y+=sign(ysp);}
- }
Expand to see the code.
Gravity - Last update 100207
- //Gravity
- //made by Markolainen
- //Put in step event for normal gravity
- //argument0=gravity;
- //argument1=maximum fall speed
- //Example: script_gravity(0.2,4);
- gravity=place_free(x,y+1)*argument0;
- vspeed=min(vspeed,argument1);
Expand to see the code.
Collision with floor (to be used with gravity NOT with Manual Gravity. On MG you only need to put the objects to solid!) - Last update 010207
- //Collision with floor
- //To be used with gravity
- //Remember to use parents if you have multiple floors such as slopes
- //made by Markolainen
- //Put in collision event with your floor/wall object
- //Example script_collison_with_floor();
- if vspeed>0{
- move_contact_solid(270,10);
- y=round(y);}
- if vspeed<0{
- move_contact_solid(90,10);}
- vspeed=0;
- gravity=0;
Expand to see the code.
Variable jumping - Last update 100207
- //Variable jumping
- //by Markolainen
- //Put in step event for jumping normally
- //argument0=jump speed (has to be negative)
- //argument1=If variable jumping should be used. Options: true & false.
- //Example script_jump(-4,true);
- if !place_free(x,y+1) and keyboard_check_pressed(vk_up){
- vspeed=argument0;}
- if place_free(x,y+1) and keyboard_check_released(vk_up) and vspeed<0 and argument1=1{
- vspeed/=2;}
Expand to see the code.
Platform movement with slopes - Last update 100206
- //Platform movement with slopes
- //made by Markolainen
- //Put in step event for walking normally
- //argument0=speed
- //Example script_move(3);
- {
- //Declare temporary variables
- var xsp;
- //Check if buttons are pressed
- xsp=(keyboard_check_direct(vk_right)-keyboard_check_direct(vk_left))*argument0;
- //Execute movement
- repeat(abs(xsp)){
- if place_free(x+sign(xsp),y+1) and !place_free(x,y+1){
- x+=sign(xsp);
- y+=1;}
- else if place_free(x+sign(xsp),y){
- x+=sign(xsp);}
- else if place_free(x+sign(xsp),y-1) and !place_free(x,y+1){
- x+=sign(xsp);
- y-=1;}}
- }
Expand to see the code.
Pixel Perfect Gravity (Manual Gravity) - Last update 100403
- //Pixel Perfect Gravity (Manual Gravity)
- //made by Markolainen
- //Put in step event for normal gravity on always
- //argument0=gravity;
- //argument1=maximum fall speed
- //Example: script_gravity(0.2,4);
- //You need to put ysp=0 in Create event of each object that uses this code!!!
- repeat(abs(ysp)){
- if place_free(x,y+sign(ysp)){
- y+=sign(ysp);}}
- if place_free(x,y+1){
- ysp=min(argument0+ysp,argument1);}
- else{
- ysp=0;}
Expand to see the code.