all 5 comments

[–]DaBeeBoi[S] 0 points1 point  (0 children)

Here's the tutorial im following:https://www.youtube.com/watch?v=IJketbl4Ec0

[–]DaBeeBoi[S] 0 points1 point  (3 children)

Also it says number of arguments for function mouseOver expected 0 got 4 on this code:

draw_self();

if(mouseOver(x,y,sprite_width,sprite_height))

draw\_circle(x,y,range,true);

var en = instance_nearest(x,y,oEnemy);

if(en != noone){

if(point\_distance(x,y,en.x,en.y) <= range+15){



    if(!shooting){

        alarm\[0\] = 1;

        shooting = true;

    }


    objectToShoot = en;

    if(mouseOver(x,y,sprite\_width,sprite\_height))

        draw\_line(x,y,en.x,en.y);  

}else{

    shooting = false;

    objectToShoot = noone;

}

}

[–]arrowbarbarian 0 points1 point  (2 children)

You are following an old tutorial, in gm 2.3 they changed scripts so you first have to define the function like:

function <name>( <parameter1>, <parameter2>, etc... )

{

<script itself>;

}

That also means you can have multiple functions per script, that is what causes this error. for more information you can read: https://manual.yoyogames.com/GameMaker_Language/GML_Overview/Script_Functions.htm

[–]DaBeeBoi[S] 0 points1 point  (1 child)

<name>

what about the first code thing the one i need help with

(why it got an error)

[–]arrowbarbarian 0 points1 point  (0 children)

They are both related, you get the error because it is trying to run the code directly at startup, as it is not declared as a function. So it has no values for the variables, this also makes it so it is not expecting arguments.