• Content Count

  • Joined

  • Last visited

About dthrasher90

  • Rank
    Advanced Member

Recent Profile Visitors

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

  1. Is it possible for a game state to access sprite info from a different file? For instance, I have created a game state in folder1/somefile and in folder2 created a bunch of functions for my sprite. Now my update function is in folder1/somefile, but I was to be able to use the functions in folder2 and put collision on them with the physics system. I can log them in folder 2 fine and the arcade body is added no problem. But when I try to pass into folder1/somefile it renders undefined. Any ideas? So it looks like this, folder1/somefile has a function move left, it works, but when you try to incorporate update into the move left function, it doesnt
  2. Yeah, just name, stats, etc. no need for sprites
  3. Is there an API out there that will create random NPCs built around predetermined specifications?
  4. The velocities in the above example work, but i cannot get it to update
  5. update: function(rg, dt1){ game.physics.arcade.collide(rg, dt1, this); //end update brackt }, // the below is in a separate file, called ona button press. function runPlayMiddle(){ playCount = +playCount; playCount += 1; console.log("playcount = ", playCount); if(playCount == 1){ var ct = game.add.sprite(220, 220, 'ct'); ct.scale.setTo(0.03); // this.game.physics.arcade.enable(ct, Phaser.Physics.ARCADE); } else{ var ct = game.add.sprite(newBallSpotx, 220, 'ct'); ct.scale.setTo(0.03); // this.game.physics.arcade.enable(ct, Phaser.Physics.ARCADE); } runningPlaysDownChecker(); Base43Defense(ct); var QBx = ct.x - 20; var QBy = ct.y; var qb = this.game.add.sprite(QBx, QBy, 'qb'); qb.scale.setTo(0.02); var RB1x = ct.x -70; var RB1y = ct.y; var rb1 = this.game.add.sprite(RB1x, RB1y, 'rb1'); rb1.scale.setTo(0.02); var spriteTextRB1 = game.add.text(RB1x, RB1y, 'RB1', { font: '9px Press Start 2P' }); var RGx = ct.x; var RGy = ct.y + 20; var rg = this.game.add.sprite(RGx, RGy, 'rg'); rg.scale.setTo(0.03); var spriteTextRG = game.add.text(RGx, RGy, 'RG', { font: '9px Press Start 2P' }); this.game.physics.arcade.enable(rg, Phaser.Physics.ARCADE); var RTx = ct.x; var RTy = rg.y + 20; var rt = this.game.add.sprite(RTx, RTy, 'rt'); rt.scale.setTo(0.03); var spriteTextRT = game.add.text(RTx, RTy, 'RT', { font: '9px Press Start 2P' }); this.game.physics.arcade.enable(rt, Phaser.Physics.ARCADE); var LGx = ct.x; var LGy = ct.y - 20; var lg = this.game.add.sprite(LGx, LGy, 'lg'); lg.scale.setTo(0.03); var spriteTextLG = game.add.text(LGx, LGy, 'LG', { font: '9px Press Start 2P' }); this.game.physics.arcade.enable(lg, Phaser.Physics.ARCADE); lg.body.velocity.x = + 25; var LTx = ct.x;
  6. is it possible to pass a sprite with an physics system from one function to another? Like i have spriteA with arcade physics enabled in file jsfile1.js. and I have a state in gamestate.js. How can I send that sprite with an active physics engine to the update function of gamestate.js
  7. is there a way to constantly check the sprite's x,y coordinates, so I can fire a callback when it crosses a certain area?
  8. hey guys, how do you set world bounds on a top down 2d game? I have an image I uploaded and I want to set the bounds to xy(700, 300), using arcade physics. What does that look like?
  9. nm, i have it figured out
  10. create: function(qb, wr1, wr2, wr3, ct, rg, rt, lg, lt, football){ var field = game.add.sprite(15, 50, 'field'); field.scale.setTo(1.1); field.anchor.setTo(0); game.physics.enable(field, Phaser.Physics.ARCADE); console.log(field); console.log("in Game Action State"); // console.log("GAS new spotws == ", newBallSpotx, newBallSpoty); Like is this correct?
  11. Is there a way to see if the body is correctly enabled on a spite. LIke should body in the console log say something other than null?
  12. is there a way for a sprite to continually update and follow another sprite? I cannot seem to figure out how to do this, every movement method isnt designed to update and change path
  13. can you chain movetobject events, like movetoobject().oncomplete(moveto another object).oncomplete( moveto another object) or something to that effect?
  14. dthrasher90


    update: function(dt1, WR1x, WR1y){ WR1x = +WR1x; WR1y = +WR1y; console.log(game.physics.arcade.angleToXY(dt1, WR1x, WR1y)); }, Is there a way i can get this to work with variables? WR1 is being tweened in another function, something like x: +500, i want to try to get other players to move towards him.
  15. Is there anyway to get a sprite to update and move towards another? After reading the docs, I ve found that moveToObject is a one shot deal. Any other ideas?