Posts tonen met het label game maker. Alle posts tonen
Posts tonen met het label game maker. Alle posts tonen

maandag 13 juni 2011

game maker snippets

Create new object, give a sprite, speed and direction

make: Object    --  create   -- code
{
bn=instance_create(300,300,obj_bal);
bn.speed = 5;
bn.direction =random(360);
getal= random(2);
if (getal < 1)
  {
  bn.sprite_index =  sprite_bal_rood;
}
else
  {
  bn.sprite_index =  sprite_bal_groen;
}
}           


Do something 4 times
for (i =0;i<4;i+=1){       }


Set a global variable,  this is a variable that can be used anywhere.
where:  room -- settingings ---code

globalvar         n_balls;

Draw a text in the window


make: object_controller  -- draw  -- code






Change sprite is mouse hovers over the sprite:
make: object -- step --code

{
 image_speed = 0;
 if (position_meeting(mouse_x,mouse_y,self))
 image_index = 1
 else
 image_index = 0
}



Go to the next room
room_goto_next(); 


Draw popup window
show_message("hallo"); 
draw_text(x,y,'Score: ' + string(score);
draw_text(x,y,"Hellow World");