• Content Count

  • Joined

  • Last visited

Everything posted by lapamplamouse

  1. I am trying to add phaser 3 games to my ionic 4 application using this method found on github ( This means rewriting my games in typescript, and some other changes. one big issue I am coming across is defining my player as alive which is the first if statement in my update(). it just returns undefined and I do not understand why. Can anyone help me on how to get around this?? Here is how I define my player: player = this.physics.add.sprite(window.innerWidth / 2, window.innerHeight - 100, 'ship'); player.setOrigin(.5, .5); //this.physics.enable(player, Phaser.Physics.Arcade); player.physicsBodyType = Phaser.Physics.Arcade; I have tried using .enable but I get the following error :"Property 'enable' does not exist on type 'ArcadePhysics'" Another possible cause: I get the following error with startSystem "Property 'startSystem' does not exist on type 'ArcadePhysics'." by adding a physics sprite I thought I would get around both these error's but no this.physics.startSystem(Phaser.Physics.Arcade);
  2. I am trying to put all my phaser 3 games into one ionic 4 application. I found the following example which works perfectly for phaser 2 ( however when I try to update to phaser three the screen goes blank. I imagine one of the problems is to do with how scenes have replaced states. does anyone have any ideas how to get around this or is this example workable anymore?? below is some code export class HomePage { constructor(private menuCtrl: MenuController) { game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, 'space- invaders', { preload: this.preload, create: this.create, update: this.update, render: this.render } ); that = Object.create(this.constructor.prototype); } preload() { this.load.image('bullet', 'assets/phaser/bullet.png'); game.load.image('enemyBullet', 'assets/phaser/enemy-bullet.png'); } } game.load works for phaser 2, if I use this.load in ionic it throws the following error ‘Property ‘load’ does not exist on type ‘HomePage’.’ With these changes to phaser is this method even possible??
  3. Hello, I am trying to add my phaser 3 game to an existing android application in android studio (Which serves other purposes beside the game). I have tried doing this by simply adding a webview to the application, it is not working at all. seems to be issues with the resolution… and some. I am now thinking off transferring the game to the phonegap template and then using webview again. is this a reasonable thing to be doing? are there any more ways I can run the game on my android application?? Where I am confused is I am not sure if phonegap games can be added to existing projects, or they can only exist independently as the application itself.
  4. Hello, I using createFromObjects to create animated sprites from tiled into my game (they are coins). I wish for them to move across the screen when the player hits into them, by setting the angularVelocity. coins = road.createFromObjects('coin', 971, { key: 'coin' });'spin', coins); However they don't seem to want to move, I can change the x and y coordinates, but I wish for this to be an animation of sorts. coins[].angle= 200; coins[].angularVelocity=10000; logging the properties to the console, shows they are updating correctly. But the sprite does not move an inch. console.log(coins[]);
  5. I am making a 2d cross country horse riding game. The player will be able to move left and right and jump obstacles. I use tiled to make the obstacle course. I want to use matter physics because I needed detailed obstacles rather than just simple shapes. I have also used collisions because I could not find any other way to define whether a user has hit an obstacle on a tile layer. As I am not using collision physics (game over when I hit a obstacle) maybe there is a way better way of doing this game. Here is how I set up the collision: const road = this.make.tilemap({key:"map"}); const roadTileset = road.addTilesetImage("terrain", "tiles"); const belowLayer = road.createStaticLayer("bot", roadTileset, 0, 0); const collisionLayer = road.createStaticLayer("collision", roadTileset, 0, 0); const treeLayer = road.createStaticLayer("tree", roadTileset, 0, 0); //const topLayer = map.createStaticLayer("top", tileset, 0, 0); //collisionLayer.setCollisionByProperty({ collides: true }); collisionLayer.setCollisionByProperty({ collides: true });;; player physics set up as follows: player = this.matter.add.sprite(400,6300, "player").setOrigin(.5, .5); player.setBody({ type: 'circle', radius: 6 }); I am now trying to get the player to jump over barriers with collides property, I was hoping to do so by pausing the collides property for half a second or so to allow the player to move through when the jump button is pressed, but this is proving more difficult than anticipated.
  6. Thanks for your reply, but I just got it working. Yes, I want the slide type controls. I added a sprite for the tiller, and created a touch rotate function for it using 'pointermove'. I then record the rotation of the tiller and translate that to the degree to which the boat turns.
  7. I am starting out with Phaser/ Phaser 3, so bear with me. I am trying to make a mobile game with viking ship going up a river. the ship will always be moving forward, I wish to have a virtual tiller which the user will touch and drag to angle the ship left and right. I.e Changing the angle which the tiller is displayed on the screen, the more severe the angle the faster the boat will turn. Currently I change direction with the arrow keys on the keyboard. I tried adding it as a button, but got the error message add.button is not a function. Can anyone suggest where to begin this process? i.e add the tiller and allow it to tilt (I will be recording it's angle to determine how much to turn the boat). Attached is a image of the what I mean by tilting.