• 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 Background speed layer_hspeed("Background", x) won't work in HTML5

T

thetafferboy

Guest
Hi all,

Run in into a frustrating issue near the end of game development. I've made one 'infinite runner' type game, so the background scrolling speed needs to keep in sync with obstacles and game objects.

This works fine, controlling the obstacle speeds and background speed with a variable. However, when I export to HTML5, I notice the
Code:
layer_hspeed("Background",global.runSpeed);
does nothing in HTML5. The background wil move, but always slower than the other objects in the game.

As a test, I used
Code:
layer_hspeed("Background",global.runSpeed+100);
and sure enough, on Desktop, the background whizzed by - but in HTML5, it stayed the same speed.

Am I doing something wrong, or is there a way around this?
 
Does it still move in html5 or just not at all?

You might want to try using layer get id to see if this speeds it up. Rather than using "Background"; get its id into a var and use that. Otherwise I'd say it's worth reporting as a bug.

Html5 is an efficiency gaining nightmare. What works fine on windows will completely clog up on html5, so you have to constantly find innovative solutions.

As a workaround, I made a runner a while back and had two sprites rotating across the screen; as one exits the view/room it resets back to start. It worked ok.
 
T

thetafferboy

Guest
Hi Micahel,

Thanks for your reply. It does move at 'original' speed - and the objects accelerate properly to the speed they are meant to get. I was thinking about a similar solution, I might just go down the 2 sprites moving route as I need to get the project wrapped up. I'll see if I can file a bug report, too.
 
Top