1. Hey! Guest! The 32nd GMC Jam will take place between Feb 22nd, 12:00 UTC (Friday noon) and Feb 25th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Draw a polygon as a object

Discussion in 'Programming' started by namunara j kim, Feb 12, 2019 at 8:09 AM.

  1. namunara j kim

    namunara j kim Member

    Joined:
    Tuesday
    Posts:
    4
    Dear experts,

    I am a very newbie of Game maker.
    I know how to use sprite and object together to make them move or collision event,

    but I want to make a object with a drawn shape (a custom polygon).
    I tried to draw a polygon with [draw_primitive], [draw_vertex] but it is only a shape on the screen
    and it doesn't collaborating like using sprite+object.

    I want to dynamically create objects with various shapes. (like every time random polygon + moving and collision))
    Can someone let me know how to achieve this?
     
    Last edited: Feb 12, 2019 at 8:14 AM
  2. chirpy

    chirpy Member

    Joined:
    Oct 6, 2016
    Posts:
    92
    How about looking into physics functions? If I understand correctly GMS uses a subset of box2d, which you can find more tutorials about.
     
  3. namunara j kim

    namunara j kim Member

    Joined:
    Tuesday
    Posts:
    4
    Thank you for your reply, maybe you are right. I will try to study physics in game maker.
     
  4. The Sorcerer

    The Sorcerer Member

    Joined:
    Jan 3, 2019
    Posts:
    138
    chirpy likes this.
  5. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    6,299
  6. RefresherTowel

    RefresherTowel Member

    Joined:
    Jul 13, 2016
    Posts:
    913
    Or draw the polygon to a surface, save the surface as a sprite, create an instance of some object you've made for this purpose (obj_polygon or whatever) and set the sprite of the instance to the previously saved sprite.
     
  7. Bayesian

    Bayesian Member

    Joined:
    Sep 13, 2016
    Posts:
    363
    Isn't he saying that he already got the polygon to draw using primitives but its not following the object around? In that case he just needs to draw the primitives relatively. @namunara j kim show use what you have so far.
     
    Last edited: Feb 15, 2019 at 3:06 AM
  8. namunara j kim

    namunara j kim Member

    Joined:
    Tuesday
    Posts:
    4
    Thank you guys!
    I will try everything.
     
  9. namunara j kim

    namunara j kim Member

    Joined:
    Tuesday
    Posts:
    4
    [Update] I think I achieved this via surface!
    Thank you all!
     

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