Jump to content

[GMS] clickable_add and running a script


kingsushi
 Share

Recommended Posts

Hi everyone

I'm having some trouble trying to execute a script through clickable_add.

This is what I have:

Sprites

spr_room1
spr_room2

Scripts

gmcallback_scr_room1()

rname="one";room_goto(room1);

gmcallback_scr_room2()

room_goto(room2);

Objects

obj_btns (persistent)

create event

rname="Start";btn_room1=clickable_add((browser_width/2)-100,browser_height/2,sprite_get_tpe(spr_room0,0),"gmcallback_scr_room1()","","");btn_room2=clickable_add((browser_width/2)+100,browser_height/2,sprite_get_tpe(spr_room1,0),"gmcallback_scr_room2()","","");

draw event

draw_text(10,10,string(rname));

Rooms (all 640x480)

room0 (contains obj_btns and window_center() in room Creation code)
room1
room2

When clicking on btn_room2, it goes to room2, but when clicking on btn_room1, it does absolutely nothing.
Am I doing something wrong or am I missing something about how the clickable_add function works?

Any help would be greatly appreciated.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...