SteveMavic

Members
  • Content Count

    12
  • Joined

  • Last visited

About SteveMavic

  • Rank
    Member

Contact Methods

  • Skype
    stevemavic

Profile Information

  • Gender
    Male
  • Location
    Poland
  1. SteveMavic

    Phaser does not recognize spritesheet

    It's a gif format but it's normal picture and I want to say that I'm dumb, because 358px is a full width of picture, in that case ~60px per frame, so It should be this.game.load.spritesheet('ZylaZlota', 'assets/images/ŻyłaZłotaFull.gif', 60, 85, 6); Sorry for making dumb question. Topic can be closed.
  2. SteveMavic

    Phaser does not recognize spritesheet

    Hello, I've tried to make spritesheet but Phaser doesn't recognized that my image has frames. Phaser thinks, that my image has just one frame. When I try to make animation, it's looks like this Code in gif zyla_zlota = game.add.sprite(800, game.world.height - 120, 'ZylaZlota'); zyla_zlota.animations.add('left', [3, 2, 1, 0], 5, true); //game.physics.arcade.enable(zyla_zlota); zyla_zlota.animations.play('left'); Declaration this.game.load.spritesheet('ZylaZlota', 'assets/images/ŻyłaZłotaFull.gif', 358, 85, 6);
  3. SteveMavic

    Multiple levels and the same code in each level

    It's working, Thank you for help
  4. SteveMavic

    Multiple levels and the same code in each level

    In index.html between <script></script> (function() { var game = new Phaser.Game(1200, 600, Phaser.AUTO, ''); game.state.add("Boot",boot); game.state.add("Preload",preload); game.state.add("Field",field); game.state.add("Town",town); /*game.state.add("GoldMine",goldMine); game.state.add("DiaxMine",diaxMine); */game.state.start("Boot"); })(); My game states (in this example field state) are written like that var field = function(game){} field.prototype = { preload: function(){ //some stuff right here }, create: function(){ StageCreate(); // basic player animations itp. // other methods and functions in specific state (level) }, update: function(){ //some stuff right here } }
  5. SteveMavic

    Multiple levels and the same code in each level

    So, I've tried to call a function inside preload and create. This is content of that function. function StageCreate(){ // Play background music Music = this.game.sound.play('OutSideMine'); Music.loopFull(1); this.game.physics.startSystem(Phaser.Physics.ARCADE); this.game.add.sprite(0, 0, 'sky'); // Setting up player this.player = this.game.add.sprite(32, this.game.world.height - 150, 'dude'); this.game.camera.follow(player); this.game.physics.arcade.enable(player); player.body.bounce.y = 0; player.body.gravity.y = 500; player.body.collideWorldBounds = true; // Animacje chodzenia w prawo i lewo WalkLeft = player.animations.add('left', [3, 2, 1, 0], 10, true); WalkRight = player.animations.add('right', [6, 7, 8, 9], 10, true); // Animacje biegania w prawo i lewo SprintLeft = player.animations.add('sprint_left', [20, 21, 22], 10, true); SprintRight = player.animations.add('sprint_right', [23, 24, 25], 10, true); // Animacje atakowania w prawo i lewo AttackRight = player.animations.add('attack_P', [12, 13, 14, 14], 10, false); AttackLeft = player.animations.add('attack_L', [17, 16, 15, 15], 10, false); AttackRight.onComplete.add(this.animStop, this); AttackLeft.onComplete.add(this.animStop, this); player.frame = 5; cursors = this.game.input.keyboard.createCursorKeys(); } I wanted to call this function in 'create' and console log said "game is not defind".
  6. Hi. I have a problem with multiple levels (game states). What can I do when, I don't want to write the same piece of code in each level over and over? I've tried to create a function in separate js file which e.g. will set player sprite, gravity, animations or will create necessary variables etc. And I failed this. Everything what I have got are errors.
  7. SteveMavic

    Setting Text Bounds causes game crashing

    I'm really a novice programmer and thanks to your idea realized that when I worked with the tutorial I downloaded an older (much older) version of the Phaser. All the problems have disappeared. Even if unconsciously, thank you for your help Sorry for my English
  8. SteveMavic

    Setting Text Bounds causes game crashing

    TypeError: CaveName.setTextBounds is not a function
  9. Hello. As I mentioned in title, setting text bounds causes game getting crashes. var bar = game.add.graphics(); bar.beginFill(0x000000, 0.2); bar.drawRect(FirstCave.position.x, 100, FirstCave.width, 230); var style = { font: "bold 25px Arial", fill: "#fff", boundsAlignH: "center", boundsAlignV: "middle" }; CaveName = game.add.text(FirstCave.position.x, 100, "Kopalnia Złota", style); //CaveName.setTextBounds(0, 100, 100, 100); Code is from THAT example. Did I made mistake somewhere?
  10. SteveMavic

    Problem with Sprite

    Thank you, it helped a lot
  11. SteveMavic

    Problem with Sprite

    Hello. I have a problem with sprite. Phaser don't see the last two animations (the animations of jump). I want to do a second "layer" of animations, but I don't want to make a very, very long picture, btw How can I solve this?