mrBobDobalina Posted June 6, 2015 Share Posted June 6, 2015 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 elsewhereplay.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 More sharing options...
Eraph Posted June 7, 2015 Share Posted June 7, 2015 You've got an uppercase 'A' in your 'arcade'.game.physics.arcade.velocityFromAngle(sprite.angle, 300, sprite.body.velocity); Link to comment Share on other sites More sharing options...
mrBobDobalina Posted June 7, 2015 Author Share Posted June 7, 2015 I know i only tried that out of frusteration it doesnt work the normal way either.and my text editor suggested it so i was like why not hahaha Link to comment Share on other sites More sharing options...
Eraph Posted June 7, 2015 Share Posted June 7, 2015 Really? That's the only change I made and I got it to work as expected. I'm using Phaser v2.3.0. Link to comment Share on other sites More sharing options...
mrBobDobalina Posted June 7, 2015 Author Share Posted June 7, 2015 Dang!Yeah im running the 2.3 as well.Well thanks for testing that out with me, I'll try running that same code on another computer when i get a chance and see how that goes. Link to comment Share on other sites More sharing options...
mrBobDobalina Posted June 12, 2015 Author Share Posted June 12, 2015 Tried running it on a brand new computer today and the game still freezes whenever I press the up arrow keyThats too bad I really like phaser and wanted it to work out Link to comment Share on other sites More sharing options...
MichaelD Posted June 12, 2015 Share Posted June 12, 2015 Does the console provide any information about the error that is occurring? Link to comment Share on other sites More sharing options...
mrBobDobalina Posted June 12, 2015 Author Share Posted June 12, 2015 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 game.physics.startSystem(Phaser.Physics.ARCADE); and when i press the UP button this error pops up TypeError: game.physics.arcade is undefined game.physics.arcade.velocityFromAngle(sprite.angle, 300, sprite.body.velocity); Strange, I'll try re-installing phaser to see if my download was messed up or something Link to comment Share on other sites More sharing options...
mrBobDobalina Posted June 17, 2015 Author Share Posted June 17, 2015 Re-installed Phaser and tried again to no avail.Tried lots of ridiculous things like running it on different computers and OS's too but I cant get the program to run. Thats crazy its working for you Link to comment Share on other sites More sharing options...
MichaelD Posted June 17, 2015 Share Posted June 17, 2015 you could put a "window.console.log(game, game.physics.arcade)" and see what the console outputs, if there is an undefined somewhere then that is your problem. Link to comment Share on other sites More sharing options...
rgk Posted June 17, 2015 Share Posted June 17, 2015 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 More sharing options...
mrBobDobalina Posted June 20, 2015 Author Share Posted June 20, 2015 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 More sharing options...
mrBobDobalina Posted June 21, 2015 Author Share Posted June 21, 2015 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 More sharing options...
Recommended Posts