Search the Community
Showing results for tags 'Examples'.
-
I'm doing this on a Windows 10 PC. I have php installed. I cloned phaser-master git source into inethub/webroot/phaser directory. Cloned the phaser-examples-master into inethub/webroot/phaser-examples directory. index file in examples says can use phaser debug runner. link shows a php file. What exactly do I have to do with that file? Not clear to me. Thanks for help.
-
When I hit the "Reload Example" button the page scrolls to the top but nothing else seems to happen... For instance if I open this Drag example and drag the sprite, then when I hit the "Reload Example" button the sprite should be back at its original position in the center, but it's not. Likewise editing the example code and hitting the button doesn't run the new code, it just scrolls to the top of the page... EDIT: oops, the button is called "Reload Example" not "Refresh" (I guess the icon reminded me of refresh;)
-
Hello everyone, I opened the Basic Phaser Template and wanted to play around with the example body debug.js from the repository. There is a code comment on the basic template index.html in the script tag which says: We did it in a window.onload event, but you can do it anywhere (requireJS load, anonymous function, jQuery dom ready, - whatever floats your boat I'm familiar with the window onload event done it many times and it works. Idk much about requireJS load, anonymous function, jQuery dom . And so It all boils down to a stupid question. I wanted to try opening the bodydebug.js from the basic template. I've changed the div container name from "Game Container" to "phaser-examples" as the bodydebug.js is referencing, i've substituted the path of an asset 'atari' to my local machine. And i pointed the script tag to read like <script type="text/javascript" src="bodydebug.js"></script> (i have changed the body debug.js to bodydebug.js too.) I'm looking for a quick way to just run the code from the js file.. Unfortunately all i see is a white screen, like it doesn't load anything. I can get the script to work if i use the modular approach. But i want to run the js file as is.. How do i do that? Please have a look at my files and tell me what's wrong? bodydebug.js index.html
-
So I'm currently following @rich 's Shoot-em-up tutorial from over here https://phaser.io/tutorials/coding-tips-007. Please have a look at the source code if you haven't already. From what I understand he create's a weapon array that holds all the weapon types (each of which are an object inside a Weapon object). Now my question is How do I access the current weapon bullets in game.physics.arcade.collide? I've used game.physics.arcade.collide(this.weapon[this.currentWeapon], this.enemies) and this works fine, the bullets and the enemy collide well. BUT what if I want to kill that bullet? How would I pass the specific bullet that collided with the enemy into a function? This is what I've tried: game.physics.arcade.collide(this.weapon[this.currentWeapon], this.enemies, function(bullet, enemy) { bullet.kill(); }, null, this); However the above code doesn't work. Bullet is undefined. What do I do?
-
The website examples do not seem to be editable anymore. I used to tweak an example and hit the "run" button, but that seems to have been replaced with reload example - which does not seem to do anything. I have tried in different browsers to be sure. Example below. http://phaser.io/examples/v2/animation/animation-events Is there a keyboard combo which might run new edits? Sorry if this has been asked before but I could not find a match when searching.
-
I have studied Yahtzee game which was found in Phaser Examples folder. I find it has been not finished. In other words, not playable yet. Has someone have finished the game somewhere? TIA
-
Hi Enpu. I really like Panda.js and the example games. Thank you very much for creating it! I wanted to confirm that the code for the example games in https://github.com/ekelokorpi/panda.js-engine-games is also MIT licensed? The examples are a great starting point for new games.. I understand that the graphics and sound assets probably have different terms, and can be replaced. So I am only asking about the license for the code, not the license for the assets. Keep up the good work!
-
While attempting to hand-transpile some Phaser examples to Typescript, Creature Phoenix example in Animation section failed to build. The creature() method does not exist on GameObjectFactory. I am using VS2015 with an advanced Typescript template and Phaser 2.4.8. I have finished transpiling over 20 examples (randomly selected) with success so far.
-
- typescript
- animation
-
(and 2 more)
Tagged with:
-
When i try to use game.create.texture from the Phaser examples, I get an error: Cannot read property 'texture' of undefined. For example, if I copy the example code from the "Generate Sprite" example, or the "More Sprites" example and try to run them locally, I get the error. The "game" variable is declared globally, for example (from the "More Sprites" example): var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { create: create }); And then within the create function, game.create.texture is used, for example: game.create.texture('chick', chick, pixelWidth, pixelHeight); I assume the error means that the "create" property doesn't exist for the "game" object. I can't spot what I'm doing wrong. Any help would be useful, thanks.
-
The web IDE for Phaser Examples allows you to modify the code and then select the Run Code button (looks like a rocket ship). It only works once. Attempt to change code after pressing the Run Code button once and repeating the button press does not work. A look at the browser's console shows this message appears after pressing Run Code the second time. Uncaught ReferenceError: VERSION is not defined IDECallback @ embed.js:60
-
I'm digging through the input tutorials. These don't work in my browser(Chrome). Tried with Edge - same thing. keyboard-justpressed << but works through localhost override-default-controls << doesn't work even through localhost Error: Uncaught TypeError: game.input.keyboard.justPressed is not a function. or other input stuff that are not a function. I tried this in my game: upKey = game.input.keyboard.addKey(Phaser.Keyboard.W);downKey = game.input.keyboard.addkey(Phaser.Keyboard.S);leftKey = game.input.keyboard.addKey(Phaser.Keyboard.A);ightKey = game.input.keyboard.addKey(Phaser.Keyboard.D); And it works. game.input.keyboard.createCursorKeys(); works, too. That's how I had it at first. UPDATE: Figured it out. Some previous version of Phaser had justPressed which in a newer version was updated to downDuration. And I saw that it's fixed in the source code at github. The one on the site is outdated. As for the override-default-controls tutorial, I've proposed some changes on gitHub. Everything's fine.
-
At least two examples on the official website failed to work. 1) http://phaser.io/examples/v2/input/override-default-controls 2)http://phaser.io/examples/v2/input/keyboard-justpressed Based on the info shown in Chrome console, both examples encountered the same error: justPressed is not a function. Does anyone have any ideas about it?
-
I am trying to test some body data for a game I'm making by modifying the Body Debug example at http://phaser.io/examples/v2/p2-physics/body-debug. I'm getting a TypeError: Undefined is not a function message when I try to run the script, however, and it is happening at the call to game.load.physics. I am using the exact code from the example besides changing the filenames to match my filesystem, and the game.load.image calls work fine, just no body data can be loaded. I just updated my phaser version from GitHub, so it shouldn't be out of date, but I'm not sure if there's some other issue causing this. I doubt it'd be a bug in Phaser. Do you think there is something wrong with the download, or is there something else that'd be causing the problem? The full code for the script and error message stack trace are below (I removed the HTML components, but they were unchanged from the downloadable code for the example: Uncaught TypeError: undefined is not a function (index):23 preload (index):23 d.StateManager.start phaser.min.js:4 d.StateManager.add phaser.min.js:4 d.StateManager.boot phaser.min.js:4 d.Game.boot phaser.min.js:5 d.Game._onBoot phaser.min.js:5 window.onload = function() { var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render }); function preload() { game.load.image('contra2', 'contra2.png'); game.load.image('bunny', 'bunny.png'); game.load.image('block', 'block.png'); game.load.image('wizball', 'wizball.png'); console.log(game.load.physics); game.load.physics('physicsData', 'sprites.json'); } var contra; var bunny; var block; var wizball; var result = 'Click a body'; function create() { // Enable p2 physics game.physics.startSystem(Phaser.Physics.P2JS); contra = game.add.sprite(100, 200, 'contra2'); bunny = game.add.sprite(550, 200, 'bunny'); block = game.add.sprite(300, 400, 'block'); wizball = game.add.sprite(500, 500, 'wizball'); game.physics.p2.enable([ contra, bunny ], true); game.physics.p2.enable([ block, wizball ], true); // Convex polys contra.body.clearShapes(); contra.body.loadPolygon('physicsData', 'contra2'); bunny.body.clearShapes(); bunny.body.loadPolygon('physicsData', 'bunny'); // Circle wizball.body.setCircle(45); game.input.onDown.add(click, this); console.log(contra.body.debug); console.log(block.body.debug); } function click(pointer) { // You can hitTest against an array of Sprites, an array of Phaser.Physics.P2.Body objects, or don't give anything // in which case it will check every Body in the whole world. var bodies = game.physics.p2.hitTest(pointer.position, [ contra, bunny, block, wizball ]); if (bodies.length === 0) { result = "You didn't click a Body"; } else { result = "You clicked: "; for (var i = 0; i < bodies.length; i++) { // The bodies that come back are p2.Body objects. // The parent property is a Phaser.Physics.P2.Body which has a property called 'sprite' // This relates to the sprites we created earlier. // The 'key' property is just the texture name, which works well for this demo but you probably need something more robust for an actual game. result = result + bodies[i].parent.sprite.key; if (i < bodies.length - 1) { result = result + ', '; } } } } function update() { bunny.body.rotateLeft(2); } function render() { game.debug.text(result, 32, 32); } };
-
im new to game development and i began with phaser which seems to be a great framework but i can't understand it's documention very well. Lets talk about phaser groups. How you understand how to use groups based on the documention ? Examples are clearer but limited they dont cover everything.
- 1 reply
-
- Phaser
- documention
-
(and 2 more)
Tagged with:
-
Hello, i'm new to phaser and i'm very excited to started coding games with it but I've encountered a problem when i was trying to load the examples provided locally. I can't run properly the basics examples, every other example runs apart from that ones and i don't know what to do, so if anyone could help me it would be nice. One more thing, since i'm new i'm having a hard time setting up my development environment... I've already tried brackets, sublime text, webstorm and netbeans and i still don't know which is better so if someone liked to share how they work with phaser or point me to a nice guide to help me it would be great. Thanks PS: Sorry for my bad english
-
I would like all we put links of things made with Phaser and other libraries here! Tween to animate a sprite and the background color in Phaser with GSAP TimelineLite (You can reverse all): http://codepen.io/jdnichollsc/pen/ZYeWEr Regards, Nicholls
-
I wanted to take a look at the filters examples, specifically 'fire' to see if I could use it in a project, but it's not showing up... (along with a number of other filters examples), I tried all my browsers (chrome, firefox, safari, mac & windows) I know I've seen this working in the past... Here's the console: "Failed to load Phaser.js from github, falling back to local copy" phaser-viewer.js:49 "Phaser v2.1.0 | Pixi.js v1.6.1 | WebGL | WebAudio | http://phaser.io" jquery-2.0.3.min.js line 4 > eval:22715 SyntaxError: syntax error view_full.html TypeError: Phaser.Filter[filter] is not a constructor jquery-2.0.3.min.js line 4 > eval:30314 TypeError: filter is undefined jquery-2.0.3.min.js line 4 > eval:31 Thanks
-
I am finally circling back around to learning Phaser and working my way through the Phaser examples one by one. I have to say a big thanks to Rich and anyone else who has been working on updating and creating new examples. I know how much effort documentation takes from a former life in software support for a large broadcast automation software suite. Thank you! I am learning so much, and I am just getting started. It's very motivating.
-
Hi There, This weekend I spent some time on a new webpage with live code examples of panda.js. So far enpu has done a remarkable job on documentation already. (Documenting and writing tutorials for an engine is really time consuming). I wanted to contribute a bit so I wrote a small "panda.js fiddler. On the site you can view small code examples and in addition the resulting code is shown in a live canvas. Even better: You can actually make adjustments to the code example and see the result on the fly! (It works sort like jsfiddle). You can find the site at: http://vermeire.home.xs4all.nl/panda It runs completely without php (I used cookies to do so). If you want the source to host it on your own site, just let me know. And yes, it is completely "panda style". I used the stylesheets of the original website. Stephan PS: I want to add much more examples in the near future, this is just the beginning with several "sprite examples".
-
I want to know what kind of games get licensed .I have heard about FGL but i have no Idea about what kind of games they approve? Want to see some approved games.
-
I know hosting the examples locally is trivial but sometimes it is just easier to have a link than configure an additional site for local hosting... don't forget your mime type of .json ;-) anyways... feel free to reference here: http://phaserjs.g30rg3d.com/ Goes without saying but... I did not create these examples nor am I trying to take credit for such. I am merely hosting them for easy access.
-
be kind just started using phaser i am using xammp apache host i installed all the phaser files and examples to my root directory the examples page opens fine but when I click on the examples all i get is the following what is wrong thanks for help in advanced !!! Phaser Version: 1.1.3New version: Back to examples Source code: View details & submit© 2013 Photon Storm Ltd. All rights reserved. Looking for a flash game framework? Try FlixelPhaser on Github@photonstormPhaser Forums
-
Hi be kind, Ive just started with this I have installed all the files for phaser in my host directory i am using xampp apache as my host i open the examples page which comes up fine then when I click on an example it display like this below and nothing happens ?? can anyone help thanks in advance super newbie !! Phaser Version: 1.1.3New version: Back to examples Source code: View details & submit© 2013 Photon Storm Ltd. All rights reserved. Looking for a flash game framework? Try FlixelPhaser on Github@photonstormPhaser Forums