• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED object not spawning in the position selected

anima

Member
so i while i was making an test game and i wanted that the player can summon some minions
in different positions each 5 steps so i did this:
Step event

if keyboard_check_press(ord("X")) && cooldown=0{
instance_create(x-32,y+144,obj_minion)
alarm[1]=5
cooldown=1
}

Alarm[1]

instance_create(x+32,y+144,obj_minion)
alarm[2]=5

alarm[2] and alarm[3] are the same thing but its 64 instead of 32[
but what happened they are spawining in the same positions
i tried using drag and drop and dint worked
and i really dont know whats happening
 

woods

Member
instance_create(x-32,y+144,obj_minion)
try this instead..
instance_create(obj_player.x-32,obj_player.y+144,obj_minion)




x/y positions are relative to the room 0,0 is top left
using the objectDotNotation you can set the coordintes relative to something(this case, the obj_player)
 

anima

Member
instance_create(x-32,y+144,obj_minion)
try this instead..
instance_create(obj_player.x-32,obj_player.y+144,obj_minion)




x/y positions are relative to the room 0,0 is top left
using the objectDotNotation you can set the coordintes relative to something(this case, the obj_player)
it worked thank you very much :D
 
Top