Zoragna

Members
  • Content count

    3
  • Joined

  • Last visited

  1. Thank you very much !
  2. Hello back ; so it seems that I work out my way around the problem : I called my extended sprite using new which made it works. But now, I really don't understand why my extended sprite don't go through their update fonction. I am calling state this way : var currentBoss; var newscore; var playState = { preload : function() { this.load.spritesheet("player","Sprites/player.bmp",32,32,3); }, create : function () { hoplite = new Player(game, 200, 300, 'player'); }, update : function() { hoplite.score[player_name] = new_score ; } }; [the player updates by checking one of its property which is a finite state machine from fsm.js ; then update accordingly and, for instance, listening for keyboard input etc.] I have no clue why my code doesn't work.
  3. Hello ! I'm quite new to Phaser, quite new to JavaScript. If there is a language I'm good in it may be Python. Well, I'm trying to work out a game using the inheritance because that's how it's supposed to be done with JS, right ? So I would supposedly end with a bunch of class-objects such as Item > Player, Item > Storage, Item > Ennemy > Boss, Item > Equipment. Item = function (game, x, y, sprite_name) { Phaser.Sprite.call(this, game, x, y, sprite_name); game.physics.enable(this, Phaser.Physics.ARCADE); // Bunch of properties }; Item.prototype.update = function () { // Bunch of things }; Item.prototype = Object.create(Phaser.Sprite.prototype); Item.prototype.constructor = Item; Player = function (game, x, y, sprite_name) { Item.call(this,game,x,y,sprite_name); // Bunch of properties }; Player.prototype.someFunction = function() { //Bunch of things }; Player.prototype.update = function () { //Bunch of things }; Player.prototype = Object.create(Item.prototype); Player.prototype.constructor = Player; But when I try to run my code, I have this error : TypeError : this.onTextureUpdate is not a function [it calls a lot of lines in phaser.js] [it calls the "[parent].call(this, parameters)" line] I really don't know what to do.