• 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!

Windows Solved!

BMatjasic

Member
Is it possible to connect a certain pointlist or a linestrip and colour it from inside?
So far I am adding an x and y to a ds_map which I add to a ds_list and then draw vertex from it. Would somehow be possible to colour a certain shape or add a texture to it (which is created by connected points). The plan is I am making a simple skiing simulator to educate myself about physics and I want to create custom terrain hill, with auto coloured snow layer. (as shown on the picture bellow).(OUTMIND YELLOW LINES (HAND DRAWN))



And this is the code that I'm using to create the lines.


HTML:
Create Event:

execute code:

Points = ds_list_create();
Points2 = ds_list_create();

Step Event:

execute code:

if(mouse_check_button_pressed(mb_left)) {
   
    var Map = ds_map_create();
    ds_map_add(Map, "x", mouse_x);
    ds_map_add(Map, "y", mouse_y);
    ds_list_add(Points, Map);
 
    show_debug_message(ds_list_size(Points));
}

Draw Event:

execute code:

draw_primitive_begin(pr_linestrip);

for(var i=0; i < ds_list_size(Points); i++) {

    var map = ds_list_find_value(Points, i);
    var xx = ds_map_find_value(map, "x");
    var yy = ds_map_find_value(map, "y");
   
    draw_set_color(c_black);
    draw_vertex(xx, yy);
    draw_set_color(c_red);
    draw_rectangle(xx-3,yy-3,xx+3,yy+3, 1);
   
   
    }


   

draw_primitive_end();

draw_primitive_begin(pr_linestrip);

for(var i=0; i < ds_list_size(Points); i++) {

    var map = ds_list_find_value(Points, i);
    var xx = ds_map_find_value(map, "x");
    var yy = ds_map_find_value(map, "y");
   
    draw_set_color(c_black);
    draw_vertex(xx, yy+50);
     draw_set_color(c_red);
    draw_rectangle(xx-3,yy-3,xx+3,yy+3, 1);
   
    }
 
   

draw_primitive_end();

Thanks in advance for any tips!
 
G

Gaspode

Guest
You've marked this post as solved - can you explain what you did - looks kind of interesting, sure it will be of help to someone, somewhere, sometime...
You should put your problem back in the post title too, just add [Solved] to it.
Thanks.
 
Top