• Content Count

  • Joined

  • Last visited

About RetroGameDev

  • Rank

Recent Profile Visitors

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

  1. Hi mattstyles, Thank you for the detailed response. I'm glad I was on the right path so I won't have to make many changes. I think adding and passing in the structured objects into an entity would be a great way to handle this, I was doing something similar before but with lots of more bloat so doing it this way will help a lot. I have put off finishing the power ups but knowing I'm on the right path and your suggestions will definitely help in finishing the game. Thanks again,
  2. Hi everyone, Looking for some advice on the approach to coding multiple powerups/upgrades. I have googled how to do this but most answers are in c#/java or based on unity so I have trouble understanding what there doing. I am making a geometry wars/asteroids clone and I am giving the player upgrades when they defeat a boss or reach certain multipliers/kills. The problem is that I am having to change lots of code and using lots of if statements to see if a powerup has been activated then changing the bullet effect and then having to change the collision function for the bullets hitting the enemies so that each powerup does something different. For example in my powerup file (handles bullet changes when new power is activated and powerup pick ups) I add more if statements to the bullet logic to change for example the bullet speed and texture then I go into the file that handles collisions and make changes to the bullet / enemies function so that if the bullet is a fire bullet for example, the enemies particle effect is changed to red from blue. I know there are better ways to do this but I'm not sure how in javascript (or any language) any help would be really appreciated some code: powerups.js (bullet logic handler function for special bullets) const scene = this.scene; const utils = this.utils; const player = scene.player.sprite; if (bullet && utils.playerDied === false) { if(utils.explodingBullet) { if(utils.specialLevel > 1) { utils.bulletSpeedSpecial = 120; } else { utils.bulletSpeedSpecial = 250; } bullet.setTexture('explodeBullet'); } else if(utils.flameBullet) { utils.bulletSpeedSpecial = 75; bullet.setTexture('orange'); if(utils.specialLevelCheck === false) { utils.specialLevelCheck = true; scene.flameEmitter.explode(); } if(utils.specialLevel > 1) { player.setTexture('playerO'); scene.playerTrailEmitter.setFrame(['white', 'orange']); } } else { bullet.setTexture('bullet'); player.setTexture('player'); scene.playerTrailEmitter.setFrame(['white']); }, scene.reticle); utils.lastFiredSpecial = time + utils.bulletSpeedSpecial; scene.physics.add.overlap(scene.baddieGroup, bullet, scene.callBacks.shootingBaddies, null, scene);
  3. Hi Samme, Thank you! I renamed this.init to this.setup and made the same changes where necessary and the level scene loaded. I had been scratching my head at this for a while and would of never thought it was because of (this.init). Thanks again really appreciate it
  4. Hi, I have ran into an issue when starting scenes for a second time. I have three scenes, a main menu scene, a level scene and the gameover scene. When I go from the level scene to any other scene and try go back to the level scene I get the error: Uncaught TypeError: is not a function. I have noticed that if I go back into the main menu scene or game over scene there is no problem, only on the level scene. What I noticed was thats the only scene I use the import modules for example: import Init from "../init.js"; import Player from "../player.js"; import Controls from "../modules/controls.js"; /** * Create arcade mode */ export default class levelScene extends Phaser.Scene { constructor() { super({ key: 'levelScene' }); } preload() { } create() { this.init = new Init(this); //etc } update() { } } I tried importing the Init module inside the game over scene and had the same error if I used this.scene.restart(); and when I took it back out the scene restarted no problems. I have been using the file structure and module approach from tutorial I am still quite new with using modules so I could be something trivial but any help or work around will be great as at the moment I need to reload the page each time. Any other info needed, please let me know. (I have tried using versions 3.11 to 3.15 and had the same error) edit: more info added. Thanks,
  5. Hi, I followed lessMilks tutorial ( on how to make a platformer and they use an array with two for loops to create the level from the tutorial - // Design the level. x = wall, o = coin, ! = lava. var level = [ 'xxxxxxxxxxxxxxxxxxxxxx', '! ! x', '! o x', '! o x', '! x', '! o ! x x', 'xxxxxxxxxxxxxxxx!!!!!x', ]; / Create the level by going through the array for (var i = 0; i < level.length; i++) { for (var j = 0; j < level[i].length; j++) { // Create a wall and add it to the 'walls' group if (level[i][j] == 'x') { var wall = game.add.sprite(30+20*j, 30+20*i, 'wall'); this.walls.add(wall); wall.body.immovable = true; } // Create a coin and add it to the 'coins' group else if (level[i][j] == 'o') { var coin = game.add.sprite(30+20*j, 30+20*i, 'coin'); this.coins.add(coin); } // Create a enemy and add it to the 'enemies' group else if (level[i][j] == '!') { var enemy = game.add.sprite(30+20*j, 30+20*i, 'enemy'); this.enemies.add(enemy); } } } I have used this to create my own level but have run into some problems and was wondering if anyone knew how to help. 1) I set my game bounds to 3000, 480, then adjusted the size of the array and the position of platforms/player/enemies etc so it all fits nicely and spaced correctly. I have noticed that each space in the array is the equivalent of 30px, 30px. Would it be possible to change this? As I can't find a way to do this. 2) I wanted to potentially make a small level editor by making adding the platforms etc, enabling drag and setting them into position (which works great). But I have no idea how to capture the position of the platform in the array. I can get the coords of the platform from within the level itself but I don't know how to reference the array. Ideally, this would work by adding and setting the platform then somehow pushing the letter ('x' from the example above) to the array. If anyone has any ideas that would be great because I am quite stumped at the moment. 3) Lastly, is making a level like this viable? I am only running this game locally and I'm having no performance issues so far. I'm quite happy creating the levels in the ide but thought I'd ask the community if they had any experience with this. Thank you, RGD