Jump to content

Using existing plain JS game while making use of phaser's scaling


ioakeimo
 Share

Recommended Posts

Hello everyone. 

I am working on a project for which I have to make a responsive html5+js game.
I worked on existing code and partly refactored it (also used ES6) to make it clearer and have better understanding of it.
It still has hardcoded sprite and drawing dimensions though which I had some trouble refactoring
(because of some assets loading issues) for my needs (responsively). So I searched a bit and found phaser.

My question is: Is there a way to use my existing code to create the game and make use of (depend on) phaser's
preload function and scale manager to do the scaling for me? (in the hardcoded static dimensions the game is fully functional)

If not, is there any general guide of the steps I should follow to fully port my plain JS game to phaser correctly?

Thanks in advance :)

Link to comment
Share on other sites

It all depends highly on how you coded your original game, look though the phaser docs and break it down but I am going to guess and say using phasers scale manager will not work properly without using phasers sprites.

Link to comment
Share on other sites

Well, I wish it would depend on how I coded it. But the code was already there when I was given the project.
As I said all dimensions are hardcoded, something I would have never done if the code was mine...

I messed around with the canvas scale method but it doesn't seem to handle the hardcoded bits as well as I would have liked.
Plus the output resolution is not even close to what phaser produces for some reason, so I'm starting the port and hopefully I can do it quick enough.

Thanks for your answer.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...