noobnr39

Members
  • Content Count

    3
  • Joined

  • Last visited

About noobnr39

  • Rank
    Newbie

Recent Profile Visitors

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

  1. > game.physics.startSystem(Phaser.Physics.ARCADE); this line seems to be the troublesome one. if I comment it, the sprite shows up, if I add it to the code, the sprite disappears
  2. that's the weird thing, it doesn't show me any errors at all sometimes it gives me the mainstate error, but not everytime ... there is basically 1 sprite used in the code, maybe someone can launch it and see if it happens to them too and thanks I know i'll solve it !!!!
  3. Hi there, Let me start off I'm a real noob at programming, one of my friends got me into this to keep me occupied during sleepless nights :P.... so I started out with the Hello World project, edited it a bit to draw a sprite, move it around with the keys, and afterwards I decided I wanted to make him jump. looked for an example using the Arcade physics, edited my code which looks something like this : window.onload = function() { var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update : update , render: render }); function preload () { game.load.image('logo', 'assets/man.jpg'); } var logo; function create () { // var logo; game.stage.backgroundColor = '#2d2d2d'; game.physics.startSystem(Phaser.Physics.ARCADE); logo = game.add.sprite(game.world.centerX, game.world.centerY, 'logo'); logo.anchor.setTo(0.5, 0.5); // gravity mods // set the world (global) gravity game.physics.arcade.gravity.y = 100; game.physics.enable( [ logo ], Phaser.Physics.ARCADE); // i suppose this is to make it bounce against the rendered window its bounds logo.body.collideWorldBounds = true; logo.body.bounce.y = 0.8; } function update () { if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)){ logo.x -= 4; } else if ( game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) { logo.x += 4; } if (game.input.keyboard.isDown(Phaser.Keyboard.UP)){ logo.y -= 4; } else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)){ logo.y += 4; } } function render() { //game.debug.spriteInfo(logo,20,32); } }; as you might have noticed, I commented some lines out to see if it would fix something... whenever I comment the game.physics.startSystem out, the sprite will respond to the keys pressed. when I remove the comment, phaser just draws a blank screen. ive been trying to adapt my code to multiple examples as shown on the phaser.io page, but I can't get it working. a little bit of help ( even with programming syntax !!! ) would be a real neat and wonderful help thank you guys for reading this if you got this far