samedi 28 janvier 2017

Using a sprite object with Phaser?

I am realllly new to game development, and even newer to phaser. I just discovered the library when I needed to find a way to build my game background. Im building a web based game in javascript. Ive already written all of the code for my game to animate/control the sprites, so I dont want to throw away that code since it works perfectly for what i want. I have my own gameengine, assetmanager etc. What my question was, is that is there a way to use my existing code with phaser? For instance, when I want to add my sprite onto my map, you have to call:

       this.player = this.game.add.sprite(100, 300, 'player');

'player' is a tag that refers to the .png file. I want to be able to add my sprite that i have already animated, which is also controlled by keys. Is there a way to do this? Is there a method in the Phaser api that allows this? Or is there a better way to render my JSON data for my tile map? I find that phaser makes everything really easy for you, but i really just want to render my background using it, and be able to add my sprites/collisions on it using the api. I am really new to this, so any advice would be great! Thanks!




Aucun commentaire:

Enregistrer un commentaire