if (distance_to_object(EnemyWitch)<400)
{
move_towards_point(instance_nearest(x,y,EnemyWitch).x,instance_nearest(x,y,EnemyWitch).y, 8);
}
else
if (distance_to_object(EnemySkull)<400)
{
move_towards_point(instance_nearest(x,y,EnemySkull).x,instance_nearest(x,y,EnemySkull).y, 8);
}
else
if (distance_to_object(EnemyCastle)<400)
{
move_towards_point(instance_nearest(x,y,EnemyCastle).x,instance_nearest(x,y,EnemyCastle).y, 8);
}
else
{
instance_destroy();
}
Here is a code i use on a bullet fired by a witch. The bullet will go to the castle of the witch when in range but not the enemyskull. Can anyone tell me what i am doing wrong ?? thanks
- Game Maker Community
- → Viewing Profile: Topics: syborg58
syborg58
Member Since 17 Apr 2011Offline Last Active Jul 29 2012 05:14 PM
Community Stats
- Group New Member
- Active Posts 14
- Profile Views 1605
- Member Title GMC Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Male
-
Location
Somerset,England
0
none
Latest Visitors
Topics I've Started
Simple Mistake
28 July 2012 - 11:23 AM
Attacking
27 July 2012 - 10:30 AM
if (distance_to_object(Witch)<400)
{
move_towards_point(instance_nearest(x,y,Witch).x,instance_nearest(x,y,Witch).y, 8);
}
if (distance_to_object(Castle)<400)
{
move_towards_point(instance_nearest(x,y,Castle).x,instance_nearest(x,y,Castle).y, 8);
}
else
{
instance_destroy();
}
this is what i have at the moment. What i want to happen is if the enemy witch (the object that fires this bullet0 is within 400 of witch then i want the bullet to go to the witch, if it isn't then i want it to check to see if the castle is with in 400, if they are both false then i want it to destroy.
I am missing something because it dosen't do either, but if i get rid of the castle one then the witch one works, if i get rid of the witch one then the castle one works.
Thankyou for any help you can give
-Syborg58
{
move_towards_point(instance_nearest(x,y,Witch).x,instance_nearest(x,y,Witch).y, 8);
}
if (distance_to_object(Castle)<400)
{
move_towards_point(instance_nearest(x,y,Castle).x,instance_nearest(x,y,Castle).y, 8);
}
else
{
instance_destroy();
}
this is what i have at the moment. What i want to happen is if the enemy witch (the object that fires this bullet0 is within 400 of witch then i want the bullet to go to the witch, if it isn't then i want it to check to see if the castle is with in 400, if they are both false then i want it to destroy.
I am missing something because it dosen't do either, but if i get rid of the castle one then the witch one works, if i get rid of the witch one then the castle one works.
Thankyou for any help you can give
-Syborg58
Look Pretty?
19 April 2011 - 07:08 PM
Hey everyone,
Is there a way, so when you ask a question , you can change the colour of the box, as the grey look awful.
thanks
Is there a way, so when you ask a question , you can change the colour of the box, as the grey look awful.
thanks
How can i freeze only a certain thing?
18 April 2011 - 09:37 PM
Hey everyone, i was wondering if i could set it so my enemy just wouldn't do anything for 20000 milliseconds(20 seconds), so in its create event i set it to sleep, 20000 milliseconds, but i sleeps the whole game(as in i can't click anything or move and everything freezes), is there another way or code to get my enemy into this stick and me outta it?
Any help or advice would be great
Thanks
Any help or advice would be great
Thanks
Help please on in-game player changes
17 April 2011 - 03:39 PM
Hi, what i was to do is when my player reaches 300 score then i want its sprite to increase in size and what i got so far is;
in a step event
start of block
if score is equal to 300
transform sprite
end of block
i used the game maker icon things
but honestly , i don't know where to put it or if anyone has a better way
Any help or advice would be great
Thanks
in a step event
start of block
if score is equal to 300
transform sprite
end of block
i used the game maker icon things
but honestly , i don't know where to put it or if anyone has a better way
Any help or advice would be great
Thanks
- Game Maker Community
- → Viewing Profile: Topics: syborg58
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content
