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

Legacy GM [Solved] why cant I click this?

  • Thread starter Quinnlan Varcoe
  • Start date
Q

Quinnlan Varcoe

Guest
Hey everyone!

I was wondering why this code stopped working if the room changed even though the object was persistent.

Global Mouse left (obj_inventory)
Code:
///Add a random item to the inventory
var gx = x_to_gx(mouse_x+17);
var gy = y_to_gy(mouse_y+17);
var add_item = choose(item.potion, item.bomb, item.sword);

if(count[# gx, gy] == 0) {
    scr_add_item(gx, gy, add_item);
}
else if (count[# gx, gy] > 0) {
    if (count[# gx, gy] < 99) {
    count[# gx, gy] ++;
    }
}
 

TheouAegis

Member
What is x_to_gx?

Just guessing, but are you sure the object is still active in the next room and not getting deactivated it? Are you sure it is not getting destroyed? You said the object is persistent but how do you know that the object is actually still there in the room? What test have you done?
 
Q

Quinnlan Varcoe

Guest
Well I could move it around in the room but not click it.

I think isolated the problem, and x_to_gx was basically a grid converter and I realize now that the issue is that my calculations are off and I need to fix the formula or something
 
Top