1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

GMS 2 instance create (and resize)

Discussion in 'Programming' started by William Garrison, Dec 2, 2019.

  1. William Garrison

    William Garrison Member

    Joined:
    Apr 16, 2019
    Posts:
    56
    So I have a thing that creates a flame when you click... problem is I use a sprite thats too big. I dont want to manually resize the sprite. I want to be able to set the size in the command when it creates. How can I do that?

    Left Pressed
    Code:
    instance_create_layer(mouse_x, mouse_y, "Flame", oFireSml);
     
  2. Rob

    Rob Member

    Joined:
    Jul 12, 2016
    Posts:
    716
    Code:
    
    flame = instance_create_layer(mouse_x, mouse_y, "Flame", oFireSml);
    
    flame.image_xscale = 0.5;
    flame.image_yscale = 0.5;
    
    
    flame will store the instance id of the instance you just created and then you can set the image variables from there (you can also use "with flame{ [code here] }" to access it too

    One thing to note is your flame sprite might look crap after altering the image size
     
  3. William Garrison

    William Garrison Member

    Joined:
    Apr 16, 2019
    Posts:
    56
    Oh my Lawd.... that is so simple. Thanks Rob. I feel silly now. But works like a charm. Thx friend.
     
    Rob likes this.

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