Search the Community

Showing results for tags 'create'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 12 results

  1. Creature Dragon example is not working.

    The main.html file. <!doctype html> <html> <head> <meta charset="utf-8" /> <link href="{{ root }}/app.css" rel="stylesheet" type="text/css"> </head> <body> <div class="flex-basic flex-row"> <div class="flex-1"></div> <div class="flex-basic flex-column"> <div class="flex-1"></div> <div id="phaser"></div> <div class="flex-1"></div> </div> <div class="flex-1"></div> </div> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/phaser.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/creature.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/p2.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-arcade-physics.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-creature.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-minimum.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-no-physics.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-split.js"></script> <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/pixi.js"></script> <script src="{{ root }}/bunch_of_functions.js"></script> <script src="{{ root }}/decorators.js"></script> <script src="./app.js"></script> </body> </html> The app.js. var game = new Phaser.Game(800, 600, Phaser.WEBGL, 'phaser-example', { preload: preload, create: create }); function preload() { game.load.image('sky', 'assets/background.png'); game.load.image('dragonTexture', 'assets/dragon_character_texture.png'); game.load.json('dragonMesh', 'assets/dragon_character_mesh.json'); } var dragon = null; function create() { game.add.image(0, 0, 'sky'); dragon = game.add.creature(450, 350, 'dragonTexture', 'dragonMesh'); dragon.scale.set(25.0); dragon.play(true); // true = loop } Error: pixi.js:76 Uncaught TypeError: PIXI.Point is not a constructor at Phaser.Stage.PIXI.DisplayObject (pixi.js:76) at Phaser.Stage.PIXI.DisplayObjectContainer (pixi.js:904) at new Phaser.Stage (phaser-split.js:9193) at Phaser.Game.boot (phaser-split.js:13780) at Phaser.Device._readyCheck (phaser-split.js:40872)
  2. Hi, I don't know where to find any information about this, so I start here^^ I'm creating a little (serious)game where you can here sound form a body. And I would like to be able to do two things: - one level where the player can choose the type of sound he wants to hear. Like I would like to hear the heart of someone who had heart surgery, and something like a dropdown list with this kind of option (heart surgery, prolapsus, etc.) that would allow him to do so. - the possibility for the player to create a new body with the sounds he wants (and eventually share it). And it would create a new file that could be easily loaded in the web browser, or even in another web page. I have no clue of where I could find this kind of information, and I hope I'm clear ^^ Cheers K.
  3. Spawning enemies at random period

    Third time from me today :D, So I want to spawn these customers at random millisecs every loop... The problem is that when the first number is generated it uses it(this specific number) for every loop after that? Any ideas? this is how I'm trying to do it, but I guess there is a better solution... I can't create a variable, since the same thing is going to happen: game.time.events.loop(Math.floor((Math.random() * 10)*1000), this.createCustomer, this);
  4. The problem of the sprite key

    Hi, Often I come with the "problem" that I start a game using separated images and later I pack them in a texture atlas. I say a problem because when you create the sprites from separated image files yo do something like this: // load the single image filesgame.load.image("bird", "assets/bird.png");game.load.image("dog", "assets/dog.png");...// create the sprites using the images keysgame.add.sprite(10, 10, "bird");game.add.sprite(20, 20, "dog");Ok, but when I decide to migrate the game to use texture atlas I come with the problem that my "create" code gets broken, why? because I should use add an extra (frame) parameter: // load the texture atlasgame.load.atlas("atlas1", "assets/atlas1.png", "assets/atlas1.json");...// create the sprites using the atlas key and the frame namegame.add.sprite(10, 10, "atlas1", "bird");game.add.sprite(20, 20, "atlas1", "dog");As you can see, I had to change all places where I create the sprites and that's a bit tedious and even error prone. Do you know if there is any way in Phaser to avoid this? A solution I see is to introduce a concept like a "key namespace", something like:// in case of images the last parameter is the namespace (default can be "global")game.load.image("bird", "assets/bird.png", "animals");game.load.image("dog", "assets/dog.png", "animals");// to create an sprite with the birdgame.add.sprite(10, 10, "animals.bird");// in case of texture atlas all frame names are registered under the "animals" namespacegame.load.atlas("atlas1", "assets/atlas1.png", "assets/atlas1.json", "animals");// so to create an sprite with the bird is the same as in images:game.add.sprite(10, 10, "animals.bird"); Or maybe just we can introduce a new "globalKeys" parameter to load the atlas: var globalKeys = true;game.load.atlas("atlas1", "assets/atlas1.png", "assets/atlas1.json", globalKeys);...// somewhere in Phaser.Loader is registered that "bird" is linked to the "atlas1" frame "bird"game.add.sprite(10, 10, "bird");Am I missing something?
  5. Say I have a simple class: class SimpleGame { game: Phaser.Game; myColor: Phaser.Color; constructor() { this.myColor = Phaser.Color.createColor(255,255,0); this.game = new Phaser.Game(1200, 600, Phaser.AUTO, 'content', { preload: this.preload, create: this.create}); } preload(){ this.game.load.image("platform", "Graphics/platform.png"); } create() { console.log(this.myColor); } } window.onload = () => { var game = new SimpleGame(); }; The console always prints/returns undefined and if I try to modify the value of myColor, it brings up an error. Can the create method not access class properties? What have I done wrong here? Thanks
  6. Basic spritesheet help needed

    Hi! Very new to programming and Phaser so be kind! I've just downloaded Phaser and have been playing around with spritesheets. I managed to get my first sprite animated using the master phaser example tutorials (http://phaser.io/examples/v2/sprites/spritesheet#download). I then tried adding a second spritesheet in a different location but it doesn't seem to play the animation (original spritesheet still loads and plays though)? I've read somewhere that using a tilemap when using multiple spritesheets is advised. Any help would be hugely appreciated! Cheers! Here's the code: function preload() { game.load.spritesheet('ms1', 'assets/sprites/bee-2-sprite.png', 72, 60, 2); game.load.spritesheet('ms2', 'assets/sprites/bee-3-sprite.png', 58, 52, 2); } function create() { sprite = game.add.sprite(50, 100, 'ms1'); sprite = game.add.sprite(150, 100, 'ms2'); sprite.animations.add('walk'); sprite.animations.play('walk', 10, true); var fly = ms1.animations.add('fly'); ms1.animations.play('fly', 10, true); }
  7. Greetings people smarter than myself. This is my first phaser self-guided exercise. I'm also very new to object oriented programming - and that may be the issue at hand. I have a single gamestate, "playgame", which has a placeTiles() function that I don't want to execute until a user clicks a "Begin" button. However, my code is not working as intended because the placeTiles() function is executing immediately upon loading. I think there is a fundamental concept that I'm missing. As you can see, I'm using preload, create, then some of my own - placetiles, showtile. Is it SOP for all of the functions inside playGame.prototype to run on initialization? If I don't want something running at that time, how do I prevent it or where should I move that block of code? Wouldn't it need to go within playGame somewhere? playGame.prototype = { myMoney: null, theEmpire: [], preload: function(){ game.stage.setBackgroundColor(0xEBEBFF); game.load.spritesheet("gadgets", "gadgets.png", tileSize, tileSize); }, create: function(){ // I've removed some code here where I create my background and color scheme // Create the Begin Button which should place the other tiles. var beginButton = game.add.button( 20,50,"gadgets",this.placeTiles(),this); beginButton.frame = 10; // There's a bunch more code here I've removed for this forum post */ }, placeTiles: function(){ for(var i=0; i < numCols; i++){ var serialButton = game.add.button( 250 * (i+1) , game.height/5 + (i*tileSpacing) , "gadgets" , this.showTile , this); serialButton.frame = i+1; serialButton.value = this.theEmpire[i]; }//i++ }, showTile: function(target){ //More functions, etc... },}; game.state.add("PlayGame", playGame); game.state.start("PlayGame"); };Any explanation or guidance would be most appreciated. Thank you for your time!
  8. Hi, i'm trying to create an object to the right of another object. I want it to check if there is an object that exists already, and if not then create the same object to the right 48 px. I tried this: grass = game.add.sprite(0, 0, 'grass'); if (!grass.body.touching.right) { game.add.sprite(grass+48, 0, 'grass'); }but no luck. any solutions? p.s. i'm fairly new to the Phaser framework, and i'm still learning how to do things like collision checking in phaser. Thanks!
  9. Hi friends! Definitely, the best way to work with collections of objects (enemies, obstacles, etc) is extend the Sprite class and to work with Groups (at least for me). In the examples on extending the Sprite class, we have: /** * Automatically called by World.update */MonsterBunny.prototype.update = function() { this.angle += this.rotateSpeed;};I can automatically call World.create function as above? to initialize the behavior of objects, and not make the call explicit to create function. Thanks, and excuse me for my english This, not work: MonsterBunny.prototype.create = function(){ ...};
  10. Sprites not spawning in right place

    Hey, So this is my first post and also my first game using Phaser, so cheers! I would post the code here, but since I split up my code into prototype files and I don't know where the error could be occurring, I'll just put up the github: https://github.com/NighNightGaming/unholy_ghosts The problem: Despite the fact that I explicitly spawn the player sprite at a certain point, it loads up to that point then instantly "snaps" to the enemy sprite, which spawns at a random x (within a range). I've been playing with it for a little bit now and can't really wrap my head around my error. Please and thank you for your help.
  11. Clementine 2- the escape

    After the relative success of our first game, Clementine: horror sheep, and requests we should improve the game, we are about to come out with a new game called Clementine 2; the escape. This game would allow you to save and load and play as different characters. If you would like to see our old game it is here. Our developer page for the game is here. When the game is released I will let the community know. Thankyou! (see the attachment for development screenshot)
  12. http://www.throwthegame.com I spent a long time working on this and would appreciate some feedback. I tried to make game creation as simple as possible. There is no scripting and game logic is handled for you. All games are created from "frameworks" which define the type of game. There currently is only one called "Modern Tactics"; a tactical-rpg. After creating your game, you can then create levels for it. Technologies: Ruby on rails Hosted on Heroku Backbone Using my own game framework but am migrating to [pixijs](https://github.com/GoodBoyDigital/pixi.js/) Using soundmanager2 (thinking about switching to howler.js; smaller lightweight) jquery nouislider backbone stickit drawingboard.js