• Content Count

  • Joined

  • Last visited

About GregDev

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Full code looks like this in case anyone else has the same issue: class Player extends Phaser.Physics.Matter.Image { constructor (config) { super(, 200, 200, 'assetKey' ) this.scene = config.scene this.scene.add.existing(this) } preUpdate (time, delta) { //it works! } }
  2. Appreciate the response, calling preUpdate() doesn't seem to do anything for me, I tried with the player and scene class out of curiosity. I had a look at the player class with the chrome debugger and I couldn't find any preUpdate() function, is there something I have to do to get it setup? EDIT Nevermind, it wasn't working because I needed to add the player to the scene
  3. Hi all, I have a scene and a player, the player needs do something in the core game loop. Whenever I run into a situation like this I always end up creating an update method on the sprite/image/whatever and calling it from the scene like this: class Level1 extends Phaser.Scene { constructor () { this.player = new Player() } update () { this.player.updatePlayer() } } class Player extends Phaser.Physics.Matter.Image { updatePlayer(){ //do something } } It doesn't look too bad in this example, but I find things get messy once you start dealing with half a dozen game objects that all need to updated, sometimes I'll need to check if any of the game objects exist before calling their update method, adding to the mess. Is there a better way to do this? I know Unity/Unreal have game objects with update methods that just work™ without any need to connect them to the game's main update loop Thanks!
  4. I would also like to know this one
  5. Built with React + Nodejs Link -
  6. A space rally type game where you try to get to the finish alive. Made with Phaser 3 using matterjs for physics. It's just on Newgrounds right now but I plan on adding it to the Google Play Store soon! LINK -> FEATURES --------------------- - 10 campaign levels - Unlockable endless mode - Retro soundtrack HOW TO PLAY --------------------- When your engine flame makes contact with walls and other ships, you gain speed and power. Power is used for shield energy, when it is full you can boost. Boosting makes you invulnerable to most collisions, improves your handling, and lets you destroy most other ships on contact. Boosting also drains your energy - boost wisely as you will be the most vulnerable after a boost CONTROLS --------------------- Turn Right - Right arrow (keyboard) - Hold right side of screen (mobile) Turn Left - Left arrow (keyboard) - Hold left side of screen (mobile) Boost (only when power is full) - Up arrow (keyboard) - Tap left and right sides of the screen at once (mobile)
  7. I have a simple list for a mobile game that I'd like to be able to scroll as if it were a webpage. I can make scroll buttons if I need to, buuuut figured I'd ask in case this problem has been solved. Thanks!
  8. Interesting.. I've only tried it with chrome, I'll see if I can put up a fix for it tonight
  9. Getting my feet wet with Phaser 3 by making a simple game with stock art. Any feedback is greatly appreciated! Description - Practice mental math in space! - Use the left/right arrow keys or click and drag to fly the ship towards cargo containers that contain the right answer. A wrong answer will destroy the ship. Features: - progressive difficulty - unlockable game modes - 8 bit soundtrack - mobile friendly PC (Newgrounds) : Android (Google Play): Source Code:
  10. Pretty fun, I'd definitely play during bus rides if it's available on mobile. I wasn't able to use the keyboard to control the game - not sure if I did something wrong <- that was fast
  11. Thanks guys! My enemies are outside the camera boundaries so I tried enabling autoCull on all my sprites, there was a slight performance increase but not as significant as what I was hoping for. I also tried messing around with kill/revive by putting all the enemies in an array and calling this in the update loop function checkSpawn(game){ for(var i =0; i< this.enemyArr.length;i++){ var distance = player.y - this.enemyArr[i].y; if(distance < 1000 && distance > -1000){ this.enemyArr[i].revive(); }else{ this.enemyArr[i].kill(); } } } This actually worked pretty well, but I'm weary of performance hits as enemyArr grows. There is a moderate amount of work for each sprite in it's update loop, so it looks like pooling might be the way to go. One thing I noticed was each sprite's update method is called regardless if alive/renderable is true or false. It's too bad there's no way to stop a sprite from updating without using destroy()
  12. Hi, I'm making a game where the player traverses through a fairly large area and occasionally encounters enemy sprites. I'm adding around 50 enemy sprites at game start and I'm noticing some performance drops, when I remove the enemy sprites the performance is fine. There's only about 5 sprites on screen at once, so I'm trying to figure out the best way to spawn enemies as they enter camera range. After reading It looks like creating a handful of sprites and using revive() or changing their x/y coordinates as the player moves around the world is a viable option, but I was wondering if there was another way to do it that doesn't result in a good deal of refactoring for me. Any ideas to save me some time?
  13. Hi guys, I'm new to the framework but I googled around abit and couldn't find an answer to this: I’m making a tile mapped game where the player needs to make their way through a tiled level by moving upwards. To achieve this the camera follows the player around a rectangular world My question is about creating 2 background TileSprites that scroll with the camera BUT not at the same speed as the camera to achieve the effect of having a background with TileSprite 1 in the distance and TileSprite 2 in the far distance Maybe something like an event handler that works like this: onCameraPositionChange(yDistance){ backgroundTileSprite1.scrollY -= yDistance/2 backgroundTileSprite2.scrollY -= yDistance/4 } Right now my setup is like this: TileSprite 1 -> moves with the camera TileSprite 2 -> stays still in background using TileSprite.fixedToCamera It looks okay right now, but I think this would convey a more convincing sense of distance. Cheers and thank you!
  14. Tried it in the mobile chrome browser using a Samsung A5, lookin good
  15. Just wanted say hi to the community by posting about my first game, it was build using the html5 canvas combined with other DOM elements. Didn't use a framework so it's pretty rough around the edges. I only released it for android (didn't want to pay the apple subscription fee :P) I'm building another mobile game using Phaser 2.9.2 CE right now and absolutely loving it - looking forward to sharing it with you guys! Google Play Store link: Any feedback/comments would be very much appreciated!