• 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!

GML Trying to make two objects or sprites interact...

C

Canamla

Guest
idk what to try at this point. I've been able to run the game with certain scripts with no effect, and the ones that seem like they might work result in aborted runs or compilation errors.

Here is one error I've been getting with a certain code:
FATAL ERROR in
action number 1
of Step Event1
for object obj_interact:

Unable to find any instance for object index '13' name '<undefined>'
at gml_Object_obj_interact_Step_1 (line 10) - if(spr_link_walkup.bbox_top[8] == spr_stairs.bbox_bottom[13]){

That code is:
if(spr_link_walkup.bbox_top[8] == spr_stairs.bbox_bottom[13]){
room_goto_next()
}


What am I doing wrong? What is the right way? To give you a glimpse, I am wanting to have Link face up towards a stairwell and enter when colliding in that direction. Let me know if screenshots would help or whatever else I can do to assist ye in my uber-noobish dilemma xD

Thank you to whoever can direct me in the right way!
 

KurtBlissZ

Member
bbox variables only work for the mask index for the instance.

you can't do SpriteName.variable (though it may do something if the sprite index matching an exsisting object index)

you can use the sprite_get_bbox functions though instead.

I'm not sure why your using arrays, you must be trying to get it for the specific frame. I'm not sure of any simple way of doing that really. You probably have to find a work around.
 

Xer0botXer0

Senpai
Code:
If distance_to_point(obj_staircase.x,obj_staircase.y) < 3
{
If obj.staircase.y > self.y
{
Room_goto(theroom)
}
}
You can also use the direction variable and setup a range.

Hope I understood what you said correctly.

To get a more aligned x position check that too with a range.
 
Top