Lolomancer

Members
  • Content Count

    6
  • Joined

  • Last visited

About Lolomancer

  • Rank
    Newbie

Recent Profile Visitors

598 profile views
  1. Well, it was interresting to complete all levels keeping in mind this game made with Phaser. A minor rendering bug with "bridge" level. Some textures of bridge jumping on textures with shards/swords. But this is triffle. Good job!
  2. Great game like a popcorn, you eat it as long as you have it near. P.S.: 2 espace3d: Is there was a port of Mario Kart on NES from SNES?
  3. Guys, thank you very much! You was absolutely right about wrong calling section. It really should be within create section with "add" instead of "addOnce" property. Just few listeners is needed within update section. Now works perfect. Thanks! P.S.: I used "console.log" and "velocity monitoring tool (debug with changed formula of velocity assignation") for tracking the number of assignations.
  4. Great and addictive work! Encounter two errors while playing: 1. "Failed to load resource: the server responded with a status of 404 (Not Found) https://melon-not-found.github.io/favicon.ico" 2. "Uncaught RangeError: Maximum call stack size exceeded kha.js:8131"
  5. Thank you very much for your reply. Well, I thought that actual code might be too massive to post it on forum "as is". I'll bring some parts in that case. There is no really difference how many seconds the key is pressed down, assignment sequence appears just once with virtually random quantity. Can't say about "assigning on every update frame", cause of poor understanding Phaser's mechanics on that stage. Hope there might be some light shining upon that matter after you'll look at the code. I'm using Phaser's Arcade Physics. About "number 3". I'm trying to realize smooth movement control system. The way it is shown in example doesn't look perfect, because some keys are "in priority" of another while simultaneously pressed. So I was looking the way to bring them to "last pressed in priority" system. Ehm, my solution at the moment is far from optimized status, so if there are better solution, please, drop me the link. Or clue... About why am I worry. Well, there are few cases. Uncontrollable number of assignations cuts me out of particular game mechanics implementation as you mentions above. And makes the programm to overloading the system. And, the code at last. If needed I can upload the whole project to GitHub. Now there are copy of crucial parts: game.js: Project.Game = function (game){ this.ship; this.engGrade = 1; //multiply coefficient for calling "enginePower" object ----------------------------------- Project.Game.prototype = { create: function () { this.ship = new Project.Player(this.game, 30, 300); this.add.existing(this.ship); this.ePow = this.ship.engine(this.engGrade); //"enginePower" object with velocity values update: function () { this.ship.keybind(this); //controls ----------------------------------- player.js: Project.Player = function (game, x, y) { Phaser.Sprite.call (this, game, x, y, 'ship'); this.physics = game.physics.arcade; this.physics.enable(this); return this; ----------------------------------- Project.Player.prototype.engine = function(grade) { var enginePower = { x: 100*grade //nominal velocity with coefficient y: 100*grade currentX:0 //storing the velocity value currentY:0 }; return (enginePower); }; Project.Player.prototype.keybind = function (gamejs) { this.cursors = gamejs.input.keyboard.createCursorKeys(); this.b = gamejs.ship.body; //don't ask this.body.velocity.setTo(0, 0); this.b.velocity.x = gamejs.ePow.currentX; //bounding the velocity with object's property this.b.velocity.y = gamejs.ePow.currentY; function thrustLeft () { gamejs.ePow.currentX = gamejs.ePow.x * -1; //direction for left this.cursors.left.onDown.addOnce(thrustLeft); //similiar for other 3 directions if (this.cursors.left.isUp && !this.cursors.right.isUp) { //making the sprite to react last pressed key gamejs.ePow.currentX = gamejs.ePow.x; if (!this.cursors.left.isUp && this.cursors.right.isUp) { //the same for other direction gamejs.ePow.currentX = gamejs.ePow.x * -1; if (this.cursors.left.isUp && this.cursors.right.isUp) { //removing velocity if no "x-dimension" key pressed gamejs.ePow.currentX = 0;
  6. Greetings, I was looking the forum for an answer, but wasn't able to find even the issue. Maybe it's just my wrong usage of Phaser mechanics. Anyway, I'll be gratefull for any information. The matter: I got two separate files ("game.js" and "player.js"). While game.js used as a "state", player.js is just an attached library with some functions. There is hotkey binding in player.js, which is called in game.js within "update" property. You know, to make an object move around. But when the hotkey is pressed, there are from 60 to 150 identical assignments happens. It is about 100 times more on the average than is needed. Question: Is there a solution to make just one assignment? Additional information: I'll try to explain the whole structure in few words. In "game.js" there is variable with object ePow = { x: 100*(settable int), y: 100*(settable int), currentX: 0, currentY: 0 } It is called within "creaton" property of game.js from player.js's another prototype, but I think it isn't important. In "player.js" there is prototype "keybind", which contains creation of hotkeys, listeners for hotkeys and assignment functions. Points of interest within keybind: 1. this.(game.js's context with sprite object).velocity.x = (game.js's context).ePow.currentX; 2. function thrustLeft () { (game.js's context).ePow.currentX = (game.js's context).ePow.x * -1; 3. this.(hotkey).onDown.addOnce(thrustLeft); When hotkeys is pressed console shows me, that value was assignet for 127 times, for example. Help