• Content count

  • Joined

  • Last visited

About dthrasher90

  • Rank
    Advanced Member
  1. Anyone tried to do a mean stack phaser where the phaser framework handled the sprites and the stack dealt with large scale data binding? Is this possible??? Or is this just crazy talk?
  2. breakHuddle = this.add.text(820, 400, "BREAK!", {font: '24px Press Start 2p', fill: '#ffffff'}); breakHuddle.inputEnabled = true; breakHuddle.events.onInputDown.add(switchState, this); function switchState(){ game.state.start('GameActionState'); } Cant seem to get this to work... is this the right idea? I am intending to switch states on a button press (text overlay).
  3. function movePlayer(){ var tweenA = game.add.tween(wr1).to({x: '+200'}, 3000); var tweenB = game.add.tween(wr2).to({x: '+200'}, 3000); var tweenC = game.add.tween(wr3).to({x: '+200'}, 3000); tweenA.start(); tweenB.start(); tweenC.start(); var tweenFootball = game.add.tween(football).to( {x: '+200', y: '-20'},500, "Linear", true, 2500); tweenFootball.onComplete.add(logCoord, this); function logCoord() { console.log(football.body.x, football.body.y); } I am creating a javascript football game and this block of code, simulates a completed pass, where the football just moves to the wr1 location. I want to create a line of scrimmage variable, that will update to the new location of the football once the play has been completed. Assuming that the catch was made, where and how do I tell it to update the line scrimmage position. Does that go in the update functions???
  4. Got it fixed, i had a bad cdn
  5. im trying to load this cdn with custom fonts, however, it doesnt always work 100% of the time. It works, so i know its coded correctly. Is there anything I can do to ensure its loaded all the time? I added the source file also.
  6. <head> <meta charset="UTF-8" /> <title>hello phaser!</title> <script src="phaser.min.js"></script> <script src="huddle.js"> </script> <script src="PressStart2P.tff"> </script> <link href="https://fonts.googleapis.com/css?family=Press+Start+2P" rel="stylesheet"> </head> /// var score = 0; scoreTextHome = game.add.text(0.1, 0, 'Home: 0', { font: '20px Press Start 2P', fill: '#ffffff' }); scoreTextAway = game.add.text(0.1, 21, 'Away: 0', { font: '20px Press Start 2P', fill: '#ffffff' }); Time = game.add.text(310, 0, 'Time: 00:00', {font: '20px Press Start 2P', fill: '#ffffff' }); DownLog = game.add.text(650, 0, '1 & 10 ',{font: '20px Press Start 2p', fill: '#ffffff' });
  7. I just created this genero scoreboard template for a game. My question is, are there any documents on creating an object like this? Is it called anything fancy in phaserland?
  8. var scoreTextHome, scoreTextAway, Time; var score = 0; scoreTextHome = game.add.text(0, 0, 'Home: 0', { font: '24px Arial', fill: '#ffffff' }); scoreTextSway = game.add.text(0, 20, 'Away: 0', { font: '24px Arial', fill: '#ffffff' }); Time = game.add.text(150, 0, 'Time: 00:00', { font: '24px Arial', fill: '#ffffff' });
  9. Is there a way to log sprite coordinates after it moves? Say you have a sprite at (here, here) and it moves to (there, there). Is there some way to get the (there, there) coordinates?
  10. Any help?? var game = new Phaser.Game(800, 600, Phaser.AUTO); var GameActionState = { preload: function(){ game.load.image('field', 'assets/field.png'); game.load.image('wr1', 'assets/reddot.png'); game.load.image('wr2', 'assets/reddot.png'); game.load.image('wr3', 'assets/reddot.png'); game.load.image('wr4', 'assets/reddot.png'); game.load.image('qb', 'assets/reddot.png'); game.load.image('football','assets/football.png'); game.load.image('button', 'assets/button.jpg'); game.load.spritesheet('player', 'assets/player2.png',61, 70, 16); }, create: function(wr1){ game.physics.startSystem(Phaser.Physics.ARCADE); game.physics.arcade.enable(wr1, wr2, wr3, wr4, football); var player= game.add.sprite(300, 300,'player');
  11. Which is the create callback?
  12. Is there a way to have phaser run mulitple tweens and switch states once the last one is completed? How can I have phaser evaluate this? var button = this.game.add.button(game.world.centerX, 500, 'button', function(){ alert("button pressed"); var tweenA = game.add.tween(wr1).to({x: '-200' }, 2000); var tweenB = game.add.tween(wr2).to({ y: '+200' }, 2000); var tweenC = game.add.tween(wr3).to({ x: '-200 '}, 2000); var tweenD = game.add.tween(wr4).to({ y: '-200'}, 2000); tweenA.start(); tweenB.start(); tweenC.start(); tweenD.start() tweenA.onComplete.add(updateMoves, this); function updateMoves(){ var d20 = Math.floor((Math.random() * 20) + 1); if(d20> 2){ console.log("ball caught by wr3"); game.state.add('HuddleState', HuddleState); game.state.start('HuddleState'); } else { console.log('incommplete pass'); }
  13. Is there a way to make one sprite move to the general direction of another, without having to calculate angles?
  14. var button = this.game.add.button(game.world.centerX, 500, 'button', function(){ alert("button pressed"); var tween = game.add.tween(wr1); tween.to({x: '+30'}, 1000); var tween1 = game.add.tween(wr2); tween.to({x: '+30'}, 3000); var tween2 = game.add.tween(wr3); tween.to({x: '+30'}, 3000); tween.start(); tween1.start(); tween2.start(); }, this, 0,0,0); My next question, is it possible to fire off all these tweens simultaneously when the button is pressed? As of mow tween is the only one to move
  15. I got it to work this way. this is more conve var wr2 = this.game.add.sprite(500, 300, 'wr2'); wr2.scale.setTo(0.5); var wr3 = this.game.add.sprite(500, 400, 'wr3'); wr3.scale.setTo(0.5); var wr4 = this.game.add.sprite(500, 455, 'wr4'); wr4.scale.setTo(0.5); var qb = this.game.add.sprite(500, 300, 'qb'); qb.scale.setTo(0.5); var football = this.game.add.sprite(500, 300, 'football'); football.scale.setTo(0.1); var button = this.game.add.button(game.world.centerX, 500, 'button', function(){ alert("button pressed"); var tween = game.add.tween(wr3); tween.to({x: '+300'}, 3000); tween.start(); }, this, 0,0,0); button.scale.setTo(0.5); game.physics.arcade.enable(wr1, wr2, wr3, wr4); nient