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

Question - Code layer_get_Xspeed routines

J

Jarmar Games

Guest
layer_get_vspeed and layer_get_hspeed seem to always return 0. I'm working on adding delta timing to my project and was looking into how to dynamically update the vertical scrolling background layers. They seem to always return 0 for me. Anyone having similar issues?

I'm using like this:

Code:
var lid = layer_get_id("space_background");
var lsp = layer_get_vspeed(lid) * global.delta_timer;
layer_vspeed(lid, lsp);
Yea, made sure global.delta_timer was not bugged. It's working as it should. I can print lsp and it will be zero.
 
Are you setting the layer vspeed prior to doing this bit of code? Because if not, then 0 * global.delta_timer will be 0. Have you tried setting the vspeed of the layer to something beforehand? Can you also do a show_debug_message to show what the layer_get_vspeed(lid) actually returns?

I've just set up a background with a vspeed of 5 and a hspeed of 10 and done the same bit of code (just without the delta_timer bit as I haven't set that up), and when I do a show_debug_message of the values it returns those that I set up in the room editor.
 
J

Jarmar Games

Guest
Hi, yes they are set by default in the room editor. I will recheck everything, since its works for you I'm confident there is something wonky with my code. Thanks for confirming that they do in fact work.
 
Top