GMS 2 'Drawing' in game

Discussion in 'Programming' started by InquiziBruh, Oct 9, 2019.

  1. InquiziBruh

    InquiziBruh Member

    Joined:
    Oct 6, 2019
    Posts:
    2
    I want to make a game that lets the player 'draw' things in game, using the mouse as a sort of brush, with an adjustable radius for size. I want the object the player draws to then have a collisions on it and count as an object with its own code. Does anyone know what the best way to do this is?
     
  2. Kawai_Oppai

    Kawai_Oppai Member

    Joined:
    Sep 26, 2019
    Posts:
    11
  3. NightFrost

    NightFrost Member

    Joined:
    Jun 24, 2016
    Posts:
    1,964
    The main points would be:
    • Create a surface identical to draw area size.
    • When user draws with mouse, draw it to the surface and copy the surface to application surface so user can see the results.
    • When draw is finished, either A) cut the empty surroundings programmatically or B) simply require that user draws a rectangle around the area that will be used.
    • Turn the selected region into a sprite. This will create a new texture page, as usual.
    • Create a collision mask for the sprite (sprite_collision_mask).
    • Assign the created sprite to an instance that needs it.
     
    Bentley and ParodyKnaveBob like this.
  4. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    3,742
    Save a list of all shapes the player places down, then loop through them and use collision functions? Surfaces are good, but I'm not sure if there's any good way to get a collision mask for them. Lists and loops, however, always work :p
     
    Bentley 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