Nodragem

Members
  • Content count

    16
  • Joined

  • Last visited

About Nodragem

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. yep, I mean, it is a big struggle to get insured for HTML gamedev. To convince insurers to cover me, I need to be able to answer questions that I have no idea what the answer is as I did not sell a game yet. For instance, when I sell an licence of my game to a HTML5 publishers: - do they own the game and related IPs? - do they process and sign-off a Quality Assessment? - do they take responsibility for quality assurance and IP checking prior to game release? - do their API limit my game so that, for instance, it cannot infringe the data protection laws of the different target countries? Basically, I need to be able to reassure the insurers that there are mechanisms in place that limit the risks that I get into a law court. The problem is that I do not know if these mechanisms exist.
  2. Hi b10b, thank you very much for the tip! I will have a look to the underwriters you suggested. I guess one big problem for me to get insured is that I am a new starter and I am not sure yet what I am going to sell and to who. I am still exploring different ideas while Insurances prefer people who have a clear definition of what they are doing.
  3. Hello, I am looking for insuring my business (as a Sole Trader). I quickly realised that, in UK, big insurance companies (e.g. AXA, SimplyBusiness) would not insure video game developers (at least for the professional indemnity). They told me to look for insurance companies specialised in insuring game developers. I open this thread so that we can share: - our experience with finding a business insurance - which insurance companies have been satisfactory so far. Hope this thread will be useful to some of us.
  4. Ok so it seems that to write this issue helped me to find a solution I just needed to add one line of code to reset the DragonBones factory: public onWaspDeath () { console.log("Dead Wasps: " + this._wasps.countDead()); if(this._wasps.countLiving() <= 1){ console.log("You killed all the Wasps!") this.game.sound.play("congrats"); this._db_factory.clear(); // IMPORTANT CHANGE this.game.state.restart(); } } It works now! hope that can help someone else.
  5. Ok, so I added a conditional breakpoint before the problematic function call, so that I can check the parameter passed to that function when the game restarts. So basically I can see what is this.texture.baseTexture.source just after I called this.game.state.restart(). Note that the problematic function renderSession.context.drawImage() in part of a loop that iterates over the objects to display. Here the results: At the third iteration, for some reason this.texture.baseTexture.source is null. That means that my third object to be displayed is null. I think, it might be something with DragonBones... Any body has already encounter a similar problem with DragonBones?
  6. Hello, I am making a prototype, and I would like my collaborators to be able to use their own tilemaps with the prototype I made. So basically, their tilemaps are not on the server that hosts the game. Note that I am using Heroku as a server. I thought of several ways to do it: uploading the file to the server from the game webpage, maybe using javascript, but I don't know if that is possible at all, as I am using Heroku, open a dialog with javascript in the game webpage that asks for a URL. This URL would link to the tilemap file, hosted somewhere on the internet. Then, I would use the following method to open the tilemap from a URL: http://phaser.io/examples/v2/loader/load-text-file. However, 1) I am not sure about how to make a 'Access-Control-Allow-Origin' header present on the server, 2) I am not sure I can use, let's say, Google Drive to provide an URL to the file. I just saw that I could use AWS S3 with Heroku: https://devcenter.heroku.com/articles/s3 but I am not sure how it will interact with Phaser. So if you already have a similar issue and have a solution, please let me know! Otherwise, I will post my solution if I find one
  7. Nodragem

    Parent child GameObjects best practice

    That's an interesting question. In phaser 2, I needed something similar recently. I wanted to have a slime that has 1) a tween animation in y scale, 2) a scale fixed physics body, and 3) UI elements attached to it (action points bar, health bar). What I finally did is to create an empty Sprite (no texture) as a root. This root has a body for the physics. Then I added a Sprite as a child to display the slime texture with a y-scale tween, and I added a group as a child for the UI elements. Please post your updates. I am also curious about what are the best practices and/or on how to do it with phaser 3.
  8. Ok, thank you for the tip, I will remove the call to clearCurrentState(). No I am not clearing the game cache and I don't think I destroy anything. Should I? I thought the restart function would do the cleaning, that's why I didn't. Concerning creating texture, I do create sprites in the create method of the game state, but not anywhere else. I will add the breakpoint you suggested and see if I can bring more information. Thank you for the help
  9. Hello, @casey, the restart() function is part of Phaser.StateManager. To call 'this.game.state.start("name_of_current_state") does essentially the same thing, I think. At least, it leads to the same error. I would say that the error is related to that code, as the error does not happen if I do not try to restart/start the current state. @samme: I already tried to remove 'clearCurrentState()'. That's what I tried first, and it leads to the same error. My naive guess is that there is an image/texture that does not load properly when I restart... But I have no idea why and how.
  10. Hello, I would like to simply restart my game after the player killed all the "wasps" on the screen. What I do for now is simply: public onWaspDeath () { console.log("Dead Wasps: " + this._wasps.countDead()); if(this._wasps.countLiving() <= 1){ // the currently killed wasp is not dead yet console.log("You killed all the Wasps!") this.game.sound.play("congrats"); this.game.state.clearCurrentState(); this.game.state.restart(); } } However, I get this error in Firefox: TypeError: Argument 1 of CanvasRenderingContext2D.drawImage could not be converted to any of: HTMLImageElement, SVGImageElement, HTMLCanvasElement, HTMLVideoElement, ImageBitmap. [Learn More] phaser.js:15696:8 s.Sprite.prototype._renderCanvas phaser.js:15696:8 s.Sprite.prototype._renderCanvas phaser.js:15701:8 s.DisplayObjectContainer.prototype._renderCanvas phaser.js:15072:8 s.DisplayObjectContainer.prototype._renderCanvas phaser.js:15072:8 s.DisplayObjectContainer.prototype._renderCanvas phaser.js:15072:8 s.CanvasRenderer.prototype.renderDisplayObject phaser.js:20563:4 s.CanvasRenderer.prototype.render phaser.js:20488:4 updateRender phaser.js:36186:12 update phaser.js:36102:16 updateRAF phaser.js:64166:12 start/this._onLoop and this error in Chrome: Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)' at i.Image.s.Sprite._renderCanvas (phaser.js:15696) at a.s.Sprite._renderCanvas (phaser.js:15701) at i.Group.s.DisplayObjectContainer._renderCanvas (phaser.js:15072) at i.World.s.DisplayObjectContainer._renderCanvas (phaser.js:15072) at i.Stage.s.DisplayObjectContainer._renderCanvas (phaser.js:15072) at s.CanvasRenderer.renderDisplayObject (phaser.js:20563) at s.CanvasRenderer.render (phaser.js:20488) at Game.updateRender (phaser.js:36186) at Game.update (phaser.js:36102) at i.RequestAnimationFrame.updateRAF (phaser.js:64166) I don't really understand :/ at all what is this error about. Any ideas? NOTE: I tried commenting `this.game.state.clearCurrentState()` and I also tried `this.game.state.start("name_of_the_current_state")` instead of `this.game.state.restart()`. That leads to the same error.
  11. Thank you for your reply I am not sure if this is what you meant, but to replace: if(this._cannon_tween !== undefined){ this._cannon_tween.stop(); this.scale.x = 1; } with: this.game.tweens.removeFrom(this.scale); Does not work. The input parameters is accepted (object, array of objects or group), but the scale.x is not resetted to 1, so that `scale.x` converges to 0.98 after few quick shots.
  12. I found a solution, but I don't know if this is the best (I post it in case that can help others). I basically keep a reference to the current tween (this._cannon_tween) applied on scale.x, if this reference is not empty at the time I shot, I stop the tween and reset scale.x: public launch(ball:Phaser.Sprite) { ball.reset(this.x + this.cannonTip.x, this.y + this.cannonTip.y); ball.body.rotation = this.rotation; ball.lifespan = 1500; // FIXME: why? ball.body.velocity.x = this.cannonTip.x * State.MISSILE_SPEED; ball.body.velocity.y = this.cannonTip.y * State.MISSILE_SPEED; if(this._cannon_tween !== undefined){ this._cannon_tween.stop(); this.scale.x = 1; } this._cannon_tween = this.game.add.tween(this.scale).to( {x:0.98}, 20, Phaser.Easing.Elastic.In, true, 0, 1, true ); }
  13. Hello, I have a cannon that shoots bullets when I press space. I use the following code to add some recoil animation to my cannon when shooting (note, by default this.scale.x = 1): public launch(ball:Phaser.Sprite) { ball.reset(this.x + this.cannonTip.x, this.y + this.cannonTip.y); ball.body.rotation = this.rotation; ball.lifespan = 1500; // FIXME: why? ball.body.velocity.x = this.cannonTip.x * State.MISSILE_SPEED; ball.body.velocity.y = this.cannonTip.y * State.MISSILE_SPEED; this.game.add.tween(this.scale).to( {x:0.98}, 20, Phaser.Easing.Elastic.In, true, 0, 1, true ); } When I run it in the browser, it works perfectly fine if I don't shoot like crazy. However, if I shoot several times very quickly, the cannon will stop to animate. I can try to shoot slowly, it will not animate anymore. My guess is that if you shot at intervals <20ms, you are starting a new tween on top of the one that is running. The previous tween is stopped but does not reset the scale.x, so that the next tween starts with a scale.x smaller than 1. Apply this several times and the new tweens end up starting at scale.x = 0.98, with the target scale.x = 0.98. In other words, you can't see any recoil anymore. So my question would be, how to cleanly add a new tween on a property while the previous tween on that property is not complete yet?
  14. Nodragem

    Socket.io and Oriented Object Paradigm

    Thank you for your answer Arcanorum. If I understand well, with your solution, in `onNewPlayer(data)`, `this` will refer to `socket` while `_this` will refer to `GameServer`? The main problem I see with this solution is that you get `_this` in the global scope, so that if you define several classes, you would need to use `_this1`, `_this2`, etc... I will definitely keep your suggestion in mind, but I am happy to wait for other suggestions if there are ??
  15. Hello everybody, I am struggling with integrating socket.io in a oriented-object paradigm. One common problem with javascript and OOP are the callbacks and `this`. For instance, if you try to do something like: GameServer.prototype = { constructor : GameServer, onConnection : function(socket){ socket.on('new_player', this.onNewPlayer); }, onNewPlayer : function (data) { ... } } The bad news is that: in `onNewPlayer(data)` , `this` will NOT refer to `GameServer`. Instead, `this` will be referring to `socket`. One solution is: GameServer.prototype = { constructor : GameServer, onConnection : function(socket){ socket.on('new_player', (data) => this.onNewPlayer(data)); }, onNewPlayer : function (data) { ... } } The good news is that: in `onNewPlayer(data)` , `this` will refer to `GameServer`. The bad news is that: in `onNewPlayer(data)`, `this` does not refer to `socket` anymore. That facilitates OOP, but that prevents an easy use of `socket.emit()` for instance. Thus, what would be the easiest/prettiest way to get a reference to `socket` in `onNewPlayer(data)` and keep `this` referring to `GameServer`? Any suggestion is welcome