MarvinB

Members
  • Content count

    37
  • Joined

  • Last visited

About MarvinB

  • Rank
    Advanced Member

Recent Profile Visitors

601 profile views
  1. FPS drop

    Hi Guys, I have multiple game states and one of them is kind of slow on mobile, while it works just fine on desktop. I ran a js profile to find out what could be the potential cause of this and attached it as a reference here. I know this image does probably not give away enough in order to make any clear predictions on what the issue for my fps drop is, but maybe the pattern of the times spent for the functions to execute yields something I could make use of. I commented out most of my update functions of that state to see whether the issue is hiding in there, but no success. The imagery and text I am rendering is also smaller and less than on my working states. I also tried to destroy and null all objects of the previous state. There might be still a couple I haven't captured. This is what I null: this.game = null; this.add = null; this.make = null; this.input = null; this.state = null; this.stage = null; this.time = null; this.world = null; Any suggestion what could go wrong?
  2. Phaser ES6

    I wrote a function that calls new game inside the function sandbox and appended this function to the global window object and it works just perfectly from outside of the script to call my function. Thanks a lot, Matt! Didn't even need to call any import of some kind.
  3. Phaser ES6

    Hi Matt, First of all, thank you for taking the time and writing up all of this! Sorry, if I will mention something you already explained, but I still need to understand everything fully. So lets say I load my game-bundle.js script transformed earlier by babelify and an angular controller within my index.html <script src="scripts/phaser.js"></script> <script src="scripts/angular-controller.js"></script> <script src="scripts/game-bundle.js"></script> To mention here is that my angular code is not tranformed with babelify. So an ES6 import within the directive that would grab my game class to init my game within the directive is not possible. (I feel like I am making it more complicated actually, by not compiling angular from ES6 to ES5 aswell and get one large bundled file, but maybe there is way to keep it as is). You mentioned that: Is there a simple way to deactivate this automated step, such that maybe all my classes become exposed?
  4. Phaser ES6

    Hi Guys, I tried the window.game approach, but calling new window.Game(); did not create my game unfortunately. The game appears in the window object though. Are these exports registered somewhere globally? (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); exports.setupChat = setupChat; Or do they only live within this function e(t,n,r) .... scope? Could I call them with regular ES5 outside of this function scope to start up my game and basically channel into this function scope? Apologies for all these follow up question. This kind of scoping is new to me.
  5. Phaser ES6

    Hi Guys, I have been using ES6 for my game development and I really enjoy the functionality it supports. I started of using this example (Boilerplate) and kept the gulp compiling/traversing script, as it suits my needs well. I ran into a little challenge, that I could not figure out yet, but maybe somebody else has a good idea on how to achieve the following: After the gulp script ran through it creates a build.js file, which starts like this (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ 'use strict'; and ends like this: },{}]},{},[44]) So it creates this nice little sandbox around my code. The sandbox is unfortunately also what is giving me a little headache, as I would like to consume some off the classes/methods outside of sandbox. For instance to simple call new Game(); from another script, that is linked to my index file. Important to mention here is that I would like to keep the sandbox and only expose certain functionality to the outside world. Hope somebody has a clever idea to help me on this issue! Thanks guys!
  6. Animation does not work

    Thank you, guys! I tried Taggrin's recommendation first, as it seemed very plausible and applicable to my situation and indeed I just had to set a boolean flag that animation currently runs to avoid calling the animation over and over again. Thanks, again!
  7. Animation does not work

    Hi guys, I have a little problem with my character animations. My player can go into different directions. The movement is based on a body.velocity change. I want to play a different animation based on the direction my player is heading. I use a simple switch statement in which I call player.loadTexture(texture); playee.animations.add(texture, null, 30, true); player.animations.play(texture); While the texture changes and loads the first frame of my spritesheet, the animation does not play until the velocity is at 0 again. So while the player is moving nothing plays. Any one any ideas what is going on?
  8. Bitmap on mobile / Lighting effects

    I further narrowed it down Phaser.blendModes.MULTIPLY seems to not work on the phone. I am assuming since the canvas has to be cleared every time, the blendmode is just too much for my phone?
  9. Empty Phaser ES6 template?

    Learned something new. Thank you!
  10. Empty Phaser ES6 template?

    Why would I run the tasks myself? That's why something like gulp exists. But it is not a compiler, that's correct. Just use this as a starting point and strip out the states, its pretty simple: https://github.com/belohlavek/phaser-es6-boilerplate
  11. The error is saying it expects p1walk01 to be in the cache, but you never load it anywhere.
  12. Empty Phaser ES6 template?

    You need the gulp compiler with babelfy to create a ES5 build file that runs in Mozilla
  13. game-scale example doesn't work anymore

    For the set screen size error, try this: Phaser.ScaleManager.prototype.setScreenSize = Phaser.ScaleManager.prototype.updateLayout;
  14. Bitmap on mobile / Lighting effects

    Hi everyone, I am making an app with Phaser and the Intel XDK. I tried to implement some simple lighting and found a simple example online. As a reference: https://jsfiddle.net/dceq2vsu/1/ It works as expected on desktop, it also works in the mobile browser, but the shadow overlay does not show, if I compile it as an app. Is bitmap not working well on mobile phones?
  15. Zoom

    Actually, found the issue. In Phaser set Object.defineProperty(Phaser.Camera.prototype, "position", { get: function () { this._position.set(this.view.centerX, this.view.centerY); return this._position; }, } fixes the issue.