• Content Count

  • Joined

  • Last visited

About SteveMavic

  • Rank

Profile Information

  • Gender
  • Location

Contact Methods

  • Skype
  1. 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'ZylaZlota', 'assets/images/ŻyłaZłotaFull.gif', 60, 85, 6); Sorry for making dumb question. Topic can be closed.
  2. 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, - 120, 'ZylaZlota'); zyla_zlota.animations.add('left', [3, 2, 1, 0], 5, true); //game.physics.arcade.enable(zyla_zlota);'left'); Declaration'ZylaZlota', 'assets/images/ŻyłaZłotaFull.gif', 358, 85, 6);
  3. 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 } }
  4. So, I've tried to call a function inside preload and create. This is content of that function. function StageCreate(){ // Play background music Music ='OutSideMine'); Music.loopFull(1);;, 0, 'sky'); // Setting up player this.player =, - 150, 'dude');;; 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 =; } I wanted to call this function in 'create' and console log said "game is not defind".
  5. 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.
  6. 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
  7. TypeError: CaveName.setTextBounds is not a function
  8. Hello. As I mentioned in title, setting text bounds causes game getting crashes. var bar =; 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?
  9. 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?