phaser-framework

Phaser: show text when sprites overlap

纵然是瞬间 提交于 2019-12-12 05:21:33
问题 I am trying to work out a way to add a text to the top left corner of the viewport when two of my sprites overlap. One of them is an item and the other is my character. I can already detect for overlap and even "pick" the item (kill the sprite) when I click a key. However I would like that a text saying something like "Click "E" to pick the sword!" appeared while the collision function is active and when I kill the sprite by picking it up the text would vanish. I tried including the text in

Phaser preloading not working in HTML5 game

强颜欢笑 提交于 2019-12-12 04:15:55
问题 I would like to have nice preloader with percentage before game on, but nothing such appearing in spite of I am procceeding according to the Examples docs and api docs. It is simple HTML5 game based on phaser framework JS library. This is my code. What might be wrong? I am not digging in phaser library I have no time to repair broken libs all the time. I am just awaiting the things working out of the box somehow: <html> <head> <meta charset="UTF-8"> <title>0002game</title> <script src="phaser

Phaser error on first load of game undefined variables

那年仲夏 提交于 2019-12-12 03:44:11
问题 When I run my game in Google Chrome and Firefox, the game screen is black, once I refresh it, it runs as it should. The error I see in the console when the screen is black is: TypeError: paddle is undefined (Firefox) Uncaught TypeError: Cannot read property 'x' of undefined (Chrome) I also have a warning: Phaser.Loader - active loading canceled / reset (Firefox & Chrome) The relevant part of my code is: var game = new Phaser.Game(800, 560, Phaser.AUTO, 'phaser-canvas', { preload: preload,

Collision of frames P2

旧街凉风 提交于 2019-12-12 02:34:29
问题 I'm trying to determine the points of the players based on the different frame that a bullet hits, is this possible? So basically I want to for example, give 100 points if figurapega matches figura, and 50 points if it does not, but I have not been please my code below. ///////Here I load the atlas this.load.atlas('Monsters', 'asset/game1/Monstruos/monstruos.png', 'asset/game1/Monstruos/monstruos.json'); ///this is the one I want to use as reference to compare createFiguraCompare: function(){

Generating and shifting the circle in loop in phaser 2

佐手、 提交于 2019-12-11 17:12:06
问题 I am new to phaser 2.3.x. These are the five positions: 1 2 3 4 5 . My problem is - I want to generate a circle_no_1 sprite at position 1. After two second I want to shift the circle_no_1 to position 2 and at the same time generate another circle_no_2 at position 1. Again after 2 second I want to generate the circle_no_3 at position 1 and shift circle_no_2 at 2 position and circle_no_1 at third position and so on in LOOP . Here what I tried :- I created an event loop of 2 second in create()

Phaser HTML5 app cannot play sound after porting by Phonegap Cloud Build

天涯浪子 提交于 2019-12-11 12:03:36
问题 This's a simple Phaser audio example. It works well on my Android web browser. However, it's muted after porting to Android app by Phonegap cloud build. I know how to play sound (and loop) in Phonegap app (How to loop a audio in phonegap?) but don't know how to apply it into the Phaser JS framework. Here's the ported app. I can install and run it but without sound. Do I miss something or Phonegap Cloud Build does support the WebAudio in Phaser JS? https://build.phonegap.com/apps/1783695/ My

Cordova: Device Ready doesn't show

纵饮孤独 提交于 2019-12-11 11:55:15
问题 I made a cordova project and device ready worked, I didn't get any errors. Then I tried to add two javascript files and a folder full of images. I have linked them in the index.html and didn't delete anything.. Now Device Ready does fire? Note: I am using Xcode and developing a game for iOS and Android. Here is the HTML: <html> <head> <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media

Game in Phaser - JavaScript and Events in AngularJS

十年热恋 提交于 2019-12-11 11:39:07
问题 How can I execute an AngularJs method from plain javascript? myApp.controller("someController",["$scope",function($scope){ //Some code was here $scope.a = valueA; $scope.b = valueB }); And a bit later in the code want to execute a function that when valid could execute an IF and if thats the case will execute my AngularJS controller or what ever. function Clicked(){ if( was clicked correctly ){ //execute my Controller and send some data to add to the DOM } I don't want my HTML elements to

How can I fix bitmapdata to the camera in Phaser?

家住魔仙堡 提交于 2019-12-11 07:58:22
问题 I'm having some trouble with bitmapdata and the camera in Phaser. I'm moving the camera as part of my game because it's a scrolling game. I'm using bitmapdata to draw a health bar, but it keeps scrolling offscreen. :/ So far I've tried: • Setting the fixedToCamera property to true • Using the move property to move it along with the scrolling • Making a sprite and adding the bitmapdata to it as a child and setting the fixedToCamera property to true My code for adding the bitmapdata to the

Phaser 2.6.2 Why objects do not block each other when changing position X and Y?

不羁岁月 提交于 2019-12-11 05:22:25
问题 The problem is simple - objects do not block each other when trying to crash. Whatever I do, the objects ignore each other and pass each other through. I also noticed that if you change the position X & Y through velocity, then the objects begin to block each other. But this does not suit me, because the velocity increases gradually, and I need the tank to move at linear speed. And you also need to avoid a rebound in a collision. That is, I need the tanks to just stop moving when they crash.