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

GMS 2 [SOLVED] Code from GMS 1.4 doesn't work?

Discussion in 'Programming' started by Nug.exe, Feb 11, 2019.

Tags:
  1. Nug.exe

    Nug.exe Member

    Joined:
    Jun 11, 2017
    Posts:
    4
    I decided to finally give GMS2 a try today by transferring a small project over to get familiar with the layout but it is not working and i'm not sure why. It's just supposed to draw polygons using primitives given randomized values when I click, but nothing happens. Occasionally a very thin colored line appears but not very often. Not sure if the syntax changed or if it could even be something in the room editor/game options i missed. Any ideas?


    Code:
    ///scr_draw_polygon
    
    var _centerx    = argument0;
    var _centery    = argument1;
    var _points        = argument2;
    var _radius        = argument3;
    var _rot        = argument4;
    var _thickness    = argument5;
    var _color        = argument6;
    
    var _dir_increment = 360/_points;
    
    draw_set_color(_color);
    
    draw_primitive_begin(pr_trianglestrip);
    
    for (var _i = 0; _i <= _points; _i++) {
        var _drawDir = _rot + _dir_increment * _i
        
        draw_vertex(_centerx + lengthdir_x(_radius, _drawDir),
                    _centery + lengthdir_x(_radius, _drawDir));
        draw_vertex(_centerx + lengthdir_x(_radius - _thickness, _drawDir),
                    _centery + lengthdir_x(_radius - _thickness, _drawDir));
    }
    
    draw_primitive_end();
    draw_set_color(c_white);
     
  2. chamaeleon

    chamaeleon Member

    Joined:
    Jun 21, 2016
    Posts:
    743
    Should work if you change it to lengthdir_y() for the y position.
     
  3. Nug.exe

    Nug.exe Member

    Joined:
    Jun 11, 2017
    Posts:
    4
    Mad lad.

    I swear I checked it twice lol, that's all I needed. Thanks!
     

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