Jump to content


Photo

Bug Driving me crazy...


  • Please log in to reply
2 replies to this topic

#1 ValmanwayGames

ValmanwayGames

    GMC Member

  • New Member
  • 29 posts
  • Version:GM8

Posted 15 May 2012 - 02:33 AM

I created an inventory screen, but for the life of me i can not figure out why the button pressed step event is not working.

I have a button in the inventory room where it will go back to the previous room.

I can set the action to keyboard check and it will follow the command and go to the room defined.

However, when i try to assign the action to a mouse press event it does not work.

Does anyone see any errors?

The following code is contained within the same object, i tried splitting the step command into a different object but still not luck.

execute code:

room_persistent=false;
global.inventoryroom=Inventory;
instance_create(550,30,button_bak_obj);

Step Event:

execute code:

for(i=0;i<=4;i+=1){
if (YoYo_MouseCheckButtonPressed(i, mb_any)){
  if (instance_place(YoYo_MouseX(i), YoYo_MouseY(i), button_bak_obj))
        {
        room_goto(global.current);
        }          
                                            }
                    }


Edited by ValmanwayGames, 15 May 2012 - 02:35 AM.

  • 0

#2 GameGeisha

GameGeisha

    GameGeisha

  • GMC Member
  • 2748 posts
  • Version:GM:Studio

Posted 15 May 2012 - 04:06 AM

You need to use instance_position() instead of instance_place(). With instance_place(), you are checking whether the current instance will be in collision with button_bak_obj if moved to the mouse coordinate. Chances are this isn't what you want, especially if your posted object doesn't come with a sprite.

If you want to avoid this kind of problem in the future, you should read this tutorial entry.

GameGeisha
  • 0

#3 ValmanwayGames

ValmanwayGames

    GMC Member

  • New Member
  • 29 posts
  • Version:GM8

Posted 15 May 2012 - 10:44 PM

Ok i think i figured out what the problem was.

Where i placed my inventory button before was remaining persistent and where I placed my back button in my inventory screen was the same.

So everytime i thought i was clicking on the back button i was actually clicking on the inventory button, from the other room.

Now the problem is, i can deactivate the button when i leave the room, but it will not reappear because it is persistent.

Is there a way to temporarily disable objects that are not in the same room as well as keeping there values?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users