starblast-modding icon indicating copy to clipboard operation
starblast-modding copied to clipboard

Function to spawn lasers

Open GatoCreador887 opened this issue 6 years ago • 0 comments

I would like a function to spawn lasers in the game. The laser object would have these properties:

  • Damage
  • Speed
  • Angle
  • Type
  • All the regular ones (x, y, vx, vy...)

Some examples:

game.addLaser({damage:12,speed:135,angle:Math.PI/2,type:0});
//Spawns a regular-looking laser with 12 damage and 135 speed, with an angle of 1.57
game.addLaser({damage:13.5,speed:110,type:1});
//Spawns a "double" laser with 13.5 damage and 110 speed
game.addLaser({damage:25,speed:90,type:2});
//Spawns a "lightning" laser with 25 damage and 90 speed
game.addLaser({damage:7,speed:205,type:3});
//Spawns a "digital" laser with 7 damage and 205 speed
game.addLaser({damage:9,speed:140,type:4});
//Spawns a "healing" laser with 9 damage and 140 speed
game.addLaser({damage:17,speed:130,type:0});
//Spawns an alien laser with 17 damage and 130 speed

EDIT: I would also like to be able to use an owner property, which would be a ship or alien.

GatoCreador887 avatar Jul 13 '18 16:07 GatoCreador887