Fangames > Game Design
Post your Code Snippets
WetWookie:
Wookie's Bugs.
Give them a small sprite (I used 7x7) with the origin in the center and uncheck "visible" in the object. Place the bug anywhere on the screen and on startup it will find a random block, place itself there, turn itself visible and start wandering around.
(click to show/hide)iangle = irandom_range(0,360);
NotPlaced = 1; (click to show/hide)if NotPlaced == 1
{
NotPlaced = 0;
bnum = irandom_range(1,instance_number(block)-2);
cnt = 0;
with block
{
other.cnt = other.cnt + 1;
if other.cnt == other.bnum
{
other.x = x + 16;
other.y = y + 16;
}
}
visible = true;
}
ContAction = ContAction - 1;
if ContAction <= 0
{
baction = choose(0,1);
ContAction = irandom_range(10, 50);
LastChange = choose(-10,-5,0,5,10,LastChange);
iangle = iangle + LastChange;
SpinDir = choose(-10,10);
}
if baction == 0
{
direction = iangle;
speed = 0;
}
if baction == 1
{
speed = 1;
if place_empty(x + hspeed,y + vspeed)
{
direction = direction + SpinDir;
speed = 0;
}
} (click to show/hide)image_angle = iangle;
draw_self();
Known issues: Crawls onto invisible objects (triggers)
Derf:
Super cheap day/night cycle I'm using in one of my latest games. Works best over a background of clouds.
Create:
--- Code: ---c1 = make_color_rgb(29,68,73);
c2 = make_color_rgb(89,146,199);
c3 = make_color_rgb(237,189,104);
c4 = make_color_rgb(150,222,219);
c5 = make_color_rgb(70,42,100);
c6 = make_color_rgb(242,95,52);
c7 = make_color_rgb(83,12,0);
c8 = make_color_rgb(14,19,38);
c9 = make_color_rgb(1,2,6);
c0 = make_color_rgb(45,37,78);
col1 = c1;
col2 = c3;
con = 0;
pha = 0;
inc = 0.125/2;
--- End code ---
Step:
--- Code: ---switch(pha){
case 0:
col1 = merge_color(c1,c2,con/100);
col2 = merge_color(c3,c4,con/100);
break;
case 1:
col1 = merge_color(c2,c5,con/100);
col2 = merge_color(c4,c6,con/100);
break;
case 2:
col1 = merge_color(c5,c7,con/100);
col2 = merge_color(c6,c8,con/100);
break;
case 3:
col1 = merge_color(c7,c9,con/100);
col2 = merge_color(c8,c0,con/100);
break;
case 4:
col1 = merge_color(c9,c1,con/100);
col2 = merge_color(c0,c3,con/100);
break;
}
con += inc;
if(con == 100){
con = 0;
pha += 1;
}
if(pha >= 5){
pha = 0;
}
--- End code ---
Draw:
--- Code: ---draw_set_blend_mode_ext(bm_src_color,bm_src_color);
draw_set_alpha(0.5);
draw_rectangle_color(0,0room_width,room_height,col1,col1,col2,col2,0);
draw_set_blend_mode(bm_normal);
draw_set_alpha(1);
--- End code ---
Free to use; don't care about credit. I would appreciate changing the colours + increment so the effects aren't completely identical but either way I'm not really too bothered. :~)
Sudnep:
This was made more for myself than other people but I'm sure people can find a use for it / edit it for their own personal use.
Orbiting Objects: Used for making an 'objProjectile' orbit about a point or another object. I'll update the link if I find any bugs with it.
updated dec 11, 2015
patrickgh3:
fontSetup - Shortcut for typing out several draw_set_somethings
oscillate - Modular script for making objects bob up and down, and similar effects
RandomFangamer:
Found this nice site called GMLScripts
It has several scripts that allow you do to many things with instances, sprites, etc.
Link: https://www.gmlscripts.com
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version