Jump to content

Angular Velocity in Phaser 2.3


mrBobDobalina
 Share

Recommended Posts

Running the new Phaser 2.3 and I've been trying all day to make a simple asteroids-type game going off the examples and the problem I'm having is--
 
game.physics.Arcade.velocityFromAngle(sprite.angle, 300, sprite.body.velocity);
 
this line of code seems to be crashing my program.

I copied it directly from phasers examples   http://phaser.io/examples/v2/arcade-physics/angular-velocity

 

Heres a copy of my code as proof I'm not just making mistakes elsewhere

play.html

 

There doesn't seem (to me) to be another way to get the ship accelerating forward based on its current direction

 

I'm running Linux (mint) if that matters at all

 

 

for example:

 

//this code works with something simple like  sprite.body.velocity.y = 200;  but when i enter the above line it freezes the game as soon as I press the up //key is pressed.

//using the other ways to say button isdown returned a black screen

 

 if (game.input.keyboard.isDown(Phaser.Keyboard.UP))
    {
            
    }

Link to comment
Share on other sites

Thanks for saying that! I didn't think about that, suppose I gave up too quickly

 

Yeah I'm getting this error:

 

TypeError: game.physics.startSystem is not a function
 
and when i press the UP button this error pops up
 

Strange, I'll try re-installing phaser to see if my download was messed up or something

Link to comment
Share on other sites

Start the physics first (before you add sprites), like in the init function that you can add.
Also like stated above, the only issue I saw was the upper case Arcade instead of arcade.

Link to comment
Share on other sites

Put the physics in an init function like you suggested and I get a black screen and the game refuses to load.

 

still getting the same errors, I understand this is my problem which I have. Getting day 1 into development and running into these kind of problems is pretty discouraging.

Link to comment
Share on other sites

Alright so I got frusterated and deleted everything that has anything to do with phaser off my computer and did everything new and now it works.

Did everything the same way, even copy pasting my previous code from above and now it wants to work. I don't understand why but I'll keep going with it...

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...