Mac OSX Destroy! I MUST DESTROY!

Discussion in 'GameMaker Studio 2 Community Tech Support' started by WWAZman, Sep 10, 2019.

  1. WWAZman

    WWAZman Member

    Joined:
    Jun 21, 2016
    Posts:
    103
    after upconverting my GMS1.4 game to GMS2, everything is in code.. most of it is ok, but I can't figure out this part.. What I need to do is, somewhere where my character is noted that dead is true, tell it to then destroy an instance of the arrows_controller (so that it doesn't keep recreating it, which is on the create step of my character - every time he dies I realized another set is recreated, lessening the transparency)

    So where can I put in the instance destroy?

    Code:
    action_set_relative(1);
    var __b__;
    __b__ = action_if(dead);
    
    if __b__
    
    {
    action_set_relative(0);
    exit;
    }
    
    __b__ = action_if_empty(0, 1, 0);
    if __b__
    {
        {
    
            action_set_relative(0);
            action_set_gravity(270, 0.4);
            action_set_relative(1);
        }
    }
    else
    {
        {
            action_set_relative(0);
            action_set_gravity(270, 0);
            action_set_relative(1);
        }
    }
    
    __b__ = action_if_variable(vspeed, 12, 2);
    if __b__
    {
        {
            action_set_relative(0);
            vspeed = 12;
            action_set_relative(1);
        }
    }
    if keyboard_check(vk_up) and jumpcontrol = true
    {
     vspeed -= 4.2
    }
    
    
    action_set_relative(0);
     
  2. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    575
    I'd cut your losses and rewrite all of that, what ever that is,

    if im reading it right put it inside the {} here

    Code:
    __b__ = action_if(dead);
     if __b__ { action_set_relative(0); exit; }
     
    WWAZman likes this.
  3. ParodyKnaveBob

    ParodyKnaveBob The Laughing Rogue

    Joined:
    Jun 23, 2016
    Posts:
    499
    That action_set_relative() function is really throwing me without context. (Of course, I'm an ignoramus without GMS2, but still.) Perhaps it'd also help (others at the very least) if you also included a screenshot of your GM:S 1.4 project's DnD list? Perhaps even better, hit the "Object Information" button on the appropriate object and copy/paste that info here? Maybe both? $:^ }
     
    WWAZman likes this.
  4. WWAZman

    WWAZman Member

    Joined:
    Jun 21, 2016
    Posts:
    103
    that *IS* the DND.. after being converted and it says it's a oneway conversion =( Everything *WAS* DND with the exception of some code snippets here and there. always commented by me so I know what does what does what and where and why. (!!!) (and actually I cleaned it up for posting here by indenting it)

    I am NOT a coder, so I'm a bit lost at best.. I know it all works, has for years,.. but now I have to modify it #nightmare.

    I'm trying to tell it to delete "arrows_controller" but I don't understand what the syntax in code is supposed to be.. if I drag a DND into it the best would be AFTER all those commands, not inbetween it.. Help understanding the syntax is GREATLY appreciated!
     
  5. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    575
  6. ParodyKnaveBob

    ParodyKnaveBob The Laughing Rogue

    Joined:
    Jun 23, 2016
    Posts:
    499
    I repeat,
    Emphasis:
    If you give the information from the 1.4 IDE, it'll give context to what you've given from the 2.x IDE.

    EDIT: Good point here:

    If I had GMS2 access, I could easily see what the compatibility script (which I more or less forgot existed) would be for action_set_relative(). Looks like I'll just mosey on along and let GMS2 users help fix this probably super simple problem.
     
    Last edited: Sep 10, 2019
  7. WWAZman

    WWAZman Member

    Joined:
    Jun 21, 2016
    Posts:
    103
  8. ParodyKnaveBob

    ParodyKnaveBob The Laughing Rogue

    Joined:
    Jun 23, 2016
    Posts:
    499
    A screenshot from GMS2 probably isn't helpful since it's just the code you pasted anyway. Fwiw, if you meant to follow my suggestion, it would look more like this:

    upload_2019-9-10_0-22-36.png

    Information about object: obj_clown
    Sprite: spr_clown
    Solid: false
    Visible: true
    Depth: 0
    Persistent: false
    Parent:
    Children:
    Mask:
    No Physics Object
    Create Event:
    start moving in directions 111101111 with speed set to 4
    scale the sprite with 1 in the xdir, 1 in the ydir, rotate over direction, and no mirroring
    set Alarm 0 to 60
    Alarm Event for alarm 0:
    start moving in directions 111101111 with speed set relative to 0
    scale the sprite with 1 in the xdir, 1 in the ydir, rotate over direction, and no mirroring
    set Alarm 0 to 60
    Collision Event with object obj_wall:
    bounce not precisely against solid objects
    scale the sprite with 1 in the xdir, 1 in the ydir, rotate over direction, and no mirroring
    play sound snd_bounce; looping: false
    Mouse Event for Left Pressed:
    set the score relative to 10
    play sound snd_click; looping: false
    jump to a random position with hor snap 0 and vert snap 0
    start moving in directions 111101111 with speed set relative to 0.5
     
  9. WWAZman

    WWAZman Member

    Joined:
    Jun 21, 2016
    Posts:
    103
    I don't have gms 1.4 on my computer anymore, I can't paste that. converting to "DND" produces the exact same code window.
     
  10. YellowAfterlife

    YellowAfterlife ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    2,380
    If you're yet to start changing the project and have a 1.4 version on hand still, a while ago I made a tool that converts all of your DnD into clean code (and then you can import that code-only project into GMS2)
     
    EvanSki, Yal and WWAZman like this.
  11. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    3,556
    Why can't you just put the code to destroy the arrow controller in the character's destroy event? Then you know it's run whenever the character is destroyed. (Just don't make the character accidentally destroy themselves in their destroy event, or it creates an infinite loop that crashes the game)
     
  12. WWAZman

    WWAZman Member

    Joined:
    Jun 21, 2016
    Posts:
    103
    ahh.. you just hit the nail on a head or two..
    String not found "Event_Other_NoMoreLives"
    String not found ""Event_Other_NomoreHealth"

    so THAT'S why the lives counter doesn't work..

    DARN you and your LOGIC!! :p hehe
     
    Last edited: Sep 11, 2019

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice