user5509020
user5509020

Reputation:

I'm trying to draw a line in Game-Maker-1.4 but "Unable to find any instance for object index"

I created an object with two events.

create event -

var i;
for (i=0; i < room_width + 1; i+=1){
xx[i] = i;
}

for (i=0; i < room_width + 1; i+=1){
    yy[i] = (sin(i)+sin(i*4))+room_height;
}

draw event -

var i;

for(i=0;i < room_width; i+=1){
    draw_line(x.xx[i],y.yy[i],x.xx[i+1],y.yy[i+1]);
}

Error -

action number 1 of Draw Event for object Gen:

Unable to find any instance for object index '128' name '' at gml_Object_Gen_DrawEvent_1 (line 4) - draw_line(x.xx[i],y.yy[i],x.xx[i+1],y.yy[i+1]);

Upvotes: 0

Views: 585

Answers (1)

user7003504
user7003504

Reputation:

you created 2 arrays of values inside the object, xx and yy. But in draw event you are looking for x.xx and y.yy, which means you are looking for array xx inside object x, and array yy inside object y. Error message says you didnt find these objects. When using dot, part before the dot is object you are looking for, and part after the dot is which value you are seeking. Like this: object.value.

Upvotes: 0

Related Questions