• 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 how to make folowing enemy(i 've got a littel problem

A

abde

Guest
hello I m new here and i need help

I m currently working at a project and im not good at programing and i m learning
at a programing school and did a contest here i can win a better pc for my futur project

I m trying to make a following enemy but i realise that i have4 objectplr(a normal,one for a gun,one f or shotgun and une for an ak47)
the thig is i did the code correctly for one single plr
here wat i did to folow the normal plr
GML:
  if distance_to_object(plr)<96
{
move_towards_point(plr.x,y,5)
}
and that for the gun plr
Code:
if object_exists(plr__gun)
{

if distance_to_object(plr__gun)<96
{move_towards_point(plr__gun.x,y,5)}

}
and every time i try the game it write


___________________________________________
############################################################################################
FATAL ERROR in
action number 3
of Step Event0
for object enemy_obj:

Unable to find any instance for object index '16' name 'plr_shotgun'
at gml_Object_enemy_obj_StepNormalEvent_3 (line 2) - {move_towards_point(plr_shotgun.x,y,5)}
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_enemy_obj_StepNormalEvent_3 (line 2)

i need the quiquest help possible please
(and i m using the old version 1,4,9999)
 

Nidoking

Member
Is this GML or drag and drop?

And did you say this is for a contest at your programming school, and you want the forum to help you win the contest so you can win a prize? I don't know about that...
 

FrostyCat

Redemption Seeker
Why don't you learn the difference between object_exists and instance_exists before competing with others?
The Manual entry on object_exists said:
This function returns whether an object with the specified index exists or not. Note that this checks to see if an object is present in the resource tree, and not actually in the game room. For that you should use the function instance_exists.
Only people who understand the difference between objects and instances deserve to win at GML.
 
A

abde

Guest
Is this GML or drag and drop?

And did you say this is for a contest at your programming school, and you want the forum to help you win the contest so you can win a prize? I don't know about that...
sorry but i m my self confused,like i said i m new at programing i just needed some help with a bad coding
 

chamaeleon

Member
Does everyone in this programming contest use GMS, or is using GMS for this contest a shortcut in order to avoid a lot of work?
 
Top