• 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!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

HTML5 Particle systems not working in HTML5

L

Leetle_toady24

Guest
Hi,

My game functions fine when running on desktop, but when I build in HTML5 "part_system_create_layer" and other related functions return undefined. I have a global variable that is assigned like so: global.P_System = part_system_create_layer(layer, true); (copied straight from the gms2 particle system tutorial), and when "variable_global_exists("P_System")" is ran, it returns neither false nor true. After a couple of hours of googling, I found https://forum.yoyogames.com/index.php?threads/html5-particle-issues.48147/ and similar users who had this issue. But after further research, I found that this bug was fixed a while ago. I am running the latest version of GameMaker Studio 2 (2.2.5), so I should not be having this problem. Also, when "global.P_System = part_system_create_layer(layer, true); " Is ran in the game start event, nothing appears when ran. When I put that in another event, Everything seems fine, but when I try to create particles, the game crashes with "cannot convert undefined to number" ,I believe this is because global.P_system is undefined (code in spoiler).

Either this bug is still around or I'm just missing something stupid.

My code:
if not variable_global_exists("P_System")
{
show_debug_message("not exist")
global.P_System = part_system_create_layer(layer, true);
}

if variable_global_exists("P_System")
{
show_debug_message("exists");
}

nothing is printed from above code.
I can recall and print other global variables, but not P_System.

global.Particle1 = part_type_create();
part_type_shape(global.Particle1, pt_shape_flare);

part_type_size(global.Particle1, 0.01, 0.05, -0.1, 0.5);

part_type_color3(global.Particle1, c_aqua, c_lime, c_red);

part_type_alpha3(global.Particle1, 0.5, 1, 0);

part_type_speed(global.Particle1, 5, 7, -0.10, 0);

part_type_direction(global.Particle1, 0, 360, 0, 20);

part_type_blend(global.Particle1, true);

part_type_life(global.Particle1, 20, 40);

when I want to make particles:

part_particles_create(global.P_System, x, y, global.Particle1, 50);

the error message I get is "cannot convert undefined to number" I believe this is because global.P_system is undefined
 
Top