PeterC

Members
  • Content Count

    6
  • Joined

  • Last visited

Everything posted by PeterC

  1. I found a solution, so this topic can be closed
  2. Hi, I was wondering if it's possible to create some kind of prefab class that isn't based on something. Some information: I'm using Grunt together with YO, i have followed the tutorial from flappy. I'm building some kind of zelda 2 game. Because i'm using different states, i'll like to create prefabs that can be included as extention and not as based on. The prefabs i've learn in the flappy tutorial is that the prefab is always based on a object (sprite,tile,group...). This is what i'm trying to do: http://screencast.com/t/HU2HQlF7 I want to have a class that shares the game object and has his own update method, And ideas, examples, is it possible? Thanks in advance! Grtz, Peter
  3. PeterC

    Zelda like game sword question

    Hi, i was wondering if there are any examples on the internet that explains how to implement sword/slash action like zelda 1 on nes. Can't find any examples. I've already implement a shoot options, that will kill the object when the item is outofbounds, For this one i need to say something like "when button down then show sword, but just for 0.5sec" . Any ideas? Thanks in advanced! Grtz, Peter
  4. PeterC

    Zelda like game sword question

    Thank you, i found an easy solution for it, i'll soon show a demonstration of the idea of my game. (Your game seems to be cool It will give me some new ideas) this.time.events.add(450, (function() { this.delayAttack = true; }), this); this.game.time.events.add(400, (function() { this.isAttack = false; //remove sprite sword here this.sw.kill(); }), this); It will show the sword for certain time and then it will hide again, you can hit again as soon when the time is over.
  5. Hi, I'm creating a 3d/2d world. I'm trying to create prefab so it's easy to structure and re-use the code. I found a weird issue with prefabs that is using animations. You expect that when you create a object of your class in your state, you mostly provide the parameter with "this" that stands for the game object: this.pl1 = new PL1(this, this.loadMap.playx, this.loadMap.playy); this.add.existing(this.pl1); In the prefab class i'm adding my animation: this.animations.add('left', [1,2], 10, true); but as soon when i run the game, it will raise an error: http://screencast.com/t/GICvrV1x This will happen only when i'm using animations. The solution at this moment that i found (as weird as it sounds) is to create the object class like this: this.pl1 = new PL1(this.game, this.loadMap.playx, this.loadMap.playy); I'm just adding this.game instead of this, this only works for prefab classes that having animations included. This class also has 'use strict'; at the top, like all the other prefab classes. Is there another way to solve this issue? Because at this moment i can't use global variables in my player class, because it's using another game object. Grtz, Peter
  6. PeterC

    Phaser + Grunt using subfolders

    Hi, I'm using grunt for phaser projects. When i try to add a "subfolder + file" in my states folder and add this to the main.js, the line in main.js will be removed a soon when i run the frunt command. Check : http://screencast.com/t/F3U9GWZAIE6 I have found something not related to phaser but that it had something to do with the configuration in the file: gruntfile.js with the flatten option, but can't figured out, do someone know how to fix it? This section: http://screencast.com/t/3vquOrVL Grtz, Peter C.