I am using a spawning system in my game and i wanted to see if this code is ok:
if distance_to_object(obj_player)>80 and global.light=true
{
instance_create(x,y, obj_mob)
}
else
{
instance_create(x,y, obj_air)
}
Spawning
Started by Devinit_gD, Aug 25 2011 05:26 PM
3 replies to this topic
#1
Posted 25 August 2011 - 05:26 PM
#2
Posted 26 August 2011 - 04:44 AM
Anyone?
#3
Posted 26 August 2011 - 07:19 AM
Anyone?
What exactly do you wanty from us? if you want to check if it works, make a new file in game maker.
what the code does is check if the distance to object player is more then 80 and global.light = true it creates an instance of obj_mob and otherwise it creates an instance of obj_air. the only problem is that you didn't define the x and y of where to spawn those instances
#4
Posted 26 August 2011 - 07:25 AM
That code works perfekt as a spawn point, you just forgot one thing.
If you have more then 1 expression you have to surround them with the "(" and the ")" chars.
These examples do work:
if (x = 100 && x = 100) {}
if x = 100 {}
This example do NOT work:
if x =100 && y = 100 {}
As for your code, change
if distance_to_object(obj_player)>80 and global.light=true
into
if (distance_to_object(obj_player)>80 and global.light=true)
If you have more then 1 expression you have to surround them with the "(" and the ")" chars.
These examples do work:
if (x = 100 && x = 100) {}
if x = 100 {}
This example do NOT work:
if x =100 && y = 100 {}
As for your code, change
if distance_to_object(obj_player)>80 and global.light=true
into
if (distance_to_object(obj_player)>80 and global.light=true)
Edited by filulilus, 26 August 2011 - 07:26 AM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











