LIST OF GGGB GAMES
Dir :
Breakout
Dir :
CLASS
Dir :
GAME_1
Dir :
MENUS
Dir :
MOUSE
Dir :
Mask
Dir :
Scrooling
Dir :
TIR
game
gameOK
gameOKMIX1
gameOKOKMOVE
gameSHURIKEN
gameZ
game_shoot_them_up
gameokokokok
Dir :
windows
Game
Game Code
Game Form
Game
Game Code
/home/bqypfkbi/domains/gggb2211.x10.bz/private_html/TPL/base/games/game.js
var linkok = $("#gggbgame").attr("linkok") + 'assets/game1/'; // // this.load.setBaseURL( linkok); var gggb_width = 800; //screen.width-15; var gggb_height = 600; //screen.height-150; const phaserConfig = { type: Phaser.CANVAS, parent: "game", width: gggb_width, height: gggb_height, backgroundColor: "#5DACD8", physics: { default: 'arcade', arcade: { gravity: { y: 10 }, debug: false } }, scene: { preload: preload, create: create, update: update }, scale: { parent: "main_frame", mode: Phaser.Scale.FIT, width: 800, height: 600 // width: gggb_width, // height: gggb_height }, }; var game = new Phaser.Game(phaserConfig); // BULLETS https://www.youtube.com/watch?v=VE0IOvKv_Bc var startship; var cursors; var bullets; var bulletTime=0; var fireButton; var positionText; var sky; function preload() { this.load.setBaseURL(linkok); this.load.image('sky', "space3.png"); this.load.image("fog", "fog.png"); this.load.image("bullet", "shiruken.png"); this.load.spritesheet('startship', "gggb_128_starshipOK2.png", { frameWidth: 128, frameHeight: 128 }, 3); } function create() { // game.physics.startSystem(Phaser.Physics.ARCADE); this.sky = this.add.tileSprite(0, 0, gggb_width, gggb_height, 'sky').setOrigin(0); this.sky.tilePositionY = 0; this.sky.tilePositionX = 0; // const fog = this.add.tileSprite(0, 0, gggb_width, gggb_height, "fog").setScale(5); startship = this.physics.add.sprite(600, 310, 'startship', 1); startship.setDisplaySize(48, 48); //this.startship.anchor.setTo(0.5, 0.5); // bullets = this.physics.add.sprite(400, 510, 'bullet', 1); /** NEO SS SHOOTING = JUST FOR SUCIDE HITSELF HIMSELF HERSELF ! */ startship.anims.create({ key: 'Left', frames: this.anims.generateFrameNumbers('startship', { frames: [0] }), frameRate: 8, repeat: 10 }); startship.anims.create({ key: 'Right', frames: this.anims.generateFrameNumbers('startship', { frames: [2] }), frameRate: 8, repeat: 10 }); var currentX = startship.x; var currentY = startship.y; // text = this.add.text(0, 0, "Position x: " + currentX + " / y: " + currentY); bullets = this.add.group([ { key: 'bullet', physicsBodyType: Phaser.Physics.ARCADE, frame: [0], anchor: [0.5, 1], setScale: { x: 0.5, y: 0.5 }, outOfBoundskill: true, checkWorldBounds: true, active: false, visible: false, arcade: { gravity: { y: -100 }, debug: false }, setXY: { x: currentX, y: currentY, stepX: 64, stepY: 64 } } ]); this.tweens.add({ targets: bullets.getChildren(), angle: 360, ease: 'Linear', repeat: -1, y: '+=0', x: this.scale.width, yoyo: true, duration: 777 }); // bullets.createMultiple('30','bullet'); // Phaser.Actions.SetXY(bullets.getChildren(), currentX, currentY); fireButton = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE); cursors = this.input.keyboard.createCursorKeys(); positionText = this.add.text(0, 50, "Position x: " + currentX + " / y: " + currentY); } function update() { currentX = startship.x; currentY = startship.y; //this.bullets.set(currentX, currentY); startship.setVelocity(0); if (cursors.up.isDown) { this.sky.tilePositionY += 2; startship.setVelocityY(-400); positionText.setText("Position x: " + currentX.toFixed(2) + " / y: " + currentY.toFixed(2)); } if (cursors.down.isDown) { this.sky.tilePositionY -= 2; startship.setVelocityY(400); positionText.setText("Position x: " + currentX.toFixed(2) + " / y: " + currentY.toFixed(2)); } if (cursors.right.isDown) { this.sky.tilePositionX += 2; startship.setVelocityX(+400); startship.anims.play('Right', true); positionText.setText("Position x: " + currentX.toFixed(2) + " / y: " + currentY.toFixed(2)); } if (cursors.left.isDown) { this.sky.tilePositionX -= 2; startship.setVelocityX(-400); startship.anims.play('Left', true); positionText.setText("Position x: " + currentX.toFixed(2) + " / y: " + currentY.toFixed(2)); } if (fireButton.isDown) { positionText.setText("Position SPACE x: " + currentX.toFixed(2) + " / SPACE y: " + currentY.toFixed(2)); fireBullet(); } } function fireBullet() { currentX = startship.x; currentY = startship.y; let bullet = this.bullets.create(currentX, currentY, 'bullet'); if (bullet) { bullets.setXY(startship.x); bullets.setActive(true); bullets.setVisible(true); } /**this.tweens.add({ targets: bullets.getChildren(), angle: 360, ease: 'Linear', repeat: -1, y: '+=0', x: this.scale.width, yoyo: true, duration: 777 }); **/ //this.bullet = bullets.getFirstExists(false); // this.bullets.reset(startship.x, startship.y); // this.bullets.body.velocity.y = +400; /** if (game.time.now > bulletTime ) { bullet = bullets.getFirstExists(false); if (bullet) { bulletTime = this.time + 200; } }**/ }
Game Form