• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

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

N

Nug.exe

Guest
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);
 

chamaeleon

Member
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);
Should work if you change it to lengthdir_y() for the y position.
 
Top