Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

GMLive.js

Write and run GML right in browser! · By YellowAfterlife

Check this code not working

A topic by icuurd12b42 created Jan 16, 2017 Views: 409 Replies: 2
Viewing posts 1 to 3

#define main

// init code here

p_angle = 0;

#define step

// update code here

#define draw

// draw code here

var numdirs;

var numdirs = 4

var d;

var dd;

d = floor(((p_angle+180/numdirs) mod 360)/(360/numdirs));

dd = round( p_angle*num_dirs/360 );

draw_text(10,10,d);

draw_text(10,30,dd);

p_angle +=5;

Developer (1 edit)

Because you've typo-ed "num_dirs" instead of "numdirs" on line assigning "dd".

Since this is JS, unset variable is equal to "undefined", math operations on it result in "NaN", and round(NaN) is... 1? Well.

Facepalm... sorry