Jump to content

Search the Community

Showing results for tags 'zenva'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 3 results

  1. Hello, I am making a game using this tutorial: https://gamedevacademy.org/how-to-make-an-infinitely-scrolling-game-with-phaser/ I made some changes to it using the Phaser Basic Project template. I am having a problem with the collision detection. In the update function I have these lines detecting if a collision has happened: update: function () { console.log("in the update function!!!!!!!!!"); // Honestly, just about anything could go here. It's YOUR game after all. // Eat your heart out! // player land on ground instead of falling through this.game.physics.arcade.collide(this.player, this.ground, this.playerHit, null, this); // player bitten by a flea this.game.physics.arcade.collide(this.player, this.fleas, this.playerBit, null, this); // player can overlap with dirt mounds this.game.physics.arcade.overlap(this.player, this.mounds, this.collect, this.checkDig, this); This collision mechanism works as long as the player does not collide with a flea or digs. (I guess this means the collision mechanism does not work.) For example when the player collides with a flea, this.playerBit is called: playerBit: function (player, flea) { //remove the flea that bit our player so it is no longer in the way flea.destroy(); //update our stats this.scratches++; this.refreshStats(); //change sprite image this.player.loadTexture('playerScratch'); this.player.animations.play('scratch', 10, true); //play whine audio this.whineSound.play(); //wait a couple of seconds for the scratch animation to play before continuing this.stopped = true; this.player.body.velocity.x = 0; this.game.time.events.add(Phaser.Timer.SECOND * 2, this.playerScratch, this); }, refreshStats: function () { this.pointsText.text = this.points; this.fleasText.text = this.maxScratches - this.scratches; }, playerScratch: function () { this.stopped = false; // check the number of scratches, if 5 or greater // the player dies if (this.scratches >= 5) { console.log("scratches greater than 4"); this.player.alive = false; // reset world, this.fleas.destroy(); this.mounds.destroy(); this.player.loadTexture('dog'); this.player.animations.play('walk', 10, true); this.player.body.setSize(this.player.standDimensions.width, this.player.standDimensions.height); //.. then run home this.player.anchor.setTo(.5, 1); this.player.scale.x = -1; this.player.body.velocity.x = -1000; // run off the screen this.game.camera.unfollow(); //..then go to Game Over state this.game.time.events.add(15000, this.gameOver, this); } else { console.log("in the playerScratch function!!!!!!!!!"); this.player.loadTexture('dog'); this.player.animations.play('walk', 3, true); this.player.body.setSize(this.player.standDimensions.width, this.player.standDimensions.height); } console.log("leaving the playerScratch function"); }, After the player scratches, the player sinks below the ground. Why is this? Here is the update function : update: function () { console.log("in the update function!!!!!!!!!"); // Honestly, just about anything could go here. It's YOUR game after all. // Eat your heart out! // player land on ground instead of falling through this.game.physics.arcade.collide(this.player, this.ground, this.playerHit, null, this); // player bitten by a flea this.game.physics.arcade.collide(this.player, this.fleas, this.playerBit, null, this); // player can overlap with dirt mounds this.game.physics.arcade.overlap(this.player, this.mounds, this.collect, this.checkDig, this); //only respond to keys and keep the speed if the player is alive if (this.player.alive && !this.stopped) { this.player.body.velocity.x = 250; //We do a little math to determine whether the game world has wrapped around. //If so, we want to destroy everything and regenerate, so the game will remain random if (!this.wrapping && this.player.x < this.game.width) { //Not used yet, but may be useful to know how many times we've wrapped this.wraps++; // once we wrap we want to destroy everything and regenerate the world this.wrapping = true; this.fleas.destroy(); this.generateFleas(); this.mounds.destroy(); this.generateMounds(); // then put things back in the correct order this.game.world.bringToTop(this.grass); this.game.world.bringToTop(this.mounds); this.game.world.bringToTop(this.ground); } else if (this.player.x >= this.game.width) { this.wrapping = false; } //take the appropriate action for swiping up or pressing up arrow on keyboard //we don't wait until the swipe is finished (this.swipe.isUp), // because of latency problems (it takes too long to jump before hitting a flea) if (this.swipe.isDown && (this.swipe.positionDown.y > this.swipe.position.y)) { this.playerJump(); } else if (this.cursors.up.isDown) { this.playerJump(); } //The game world is infinite in the x-direction, so we wrap around. //We subtract padding so the player will remain in the middle of the screen when //wrapping, rather than going to the end of the screen first. this.game.world.wrap(this.player, -(this.game.width / 2), false, true, false); } },
  2. Hi, I have been going through a tutorial on recreating FruitNinja (unimportant maybe). I am a beginner in JS with experiance in Java. I need some help or reference where to get it - I have 2 states like this: var FruitNinja = FruitNinja || {}; FruitNinja.JSONLevelState = function () { "use strict"; Phaser.State.call(this); }; FruitNinja.JSONLevelState.prototype = Object.create(Phaser.State.prototype); FruitNinja.JSONLevelState.prototype.constructor = FruitNinja.JSONLevelState; (...) FruitNinja.JSONLevelState.prototype.create = function () { this.create_prefab(prefab_name, this.level_data.prefabs[prefab_name]); }; FruitNinja.JSONLevelState.prototype.create_prefab = function (prefab_name, prefab_data) { if (this.prefab_classes.hasOwnProperty(prefab_data.type)) { do stuff... }; (...) and var FruitNinja = FruitNinja || {}; FruitNinja.LevelState = function () { "use strict"; FruitNinja.JSONLevelState.call(this); this.prefab_classes = { "background": FruitNinja.Prefab.prototype.constructor, (...) }; }; FruitNinja.LevelState.prototype = Object.create(FruitNinja.JSONLevelState.prototype); FruitNinja.LevelState.prototype.constructor = FruitNinja.LevelState; FruitNinja.LevelState.prototype.create = function () { "use strict"; FruitNinja.JSONLevelState.prototype.create.call(this); (...) } Somehow JSONLevelState can access LevelState this.prefab_classe object. I don't understand how. Can I somehow print it to chrome console? Or can someone explain it or point me to some external reference ? I have watched couple of videos on youtube on inheritance in JS but I still don't get it. Please help, Ok Solved. "FruitNinja.JSONLevelState.call(this);" allows dunc from JSONLevelState be called in LevelState object (having access to its variables. Watch https://youtu.be/PMfcsYzj-9M for a complete explanation.
  3. I wanted to share my game Huungree RPG, now officially released for iOS, Android and Amazon. It's a retro-style RPG with tactic battles built using the Lime.js framework and wrapped with Cordova (command-line tools for Android and Phonegap Build for iOS). It's inspiration comes from the old Heroes of Might and Magic pc games. I explain some parts of the development process in this screencast. Game links: -iOS (lite version and full version) -Android (lite version and full version) -Amazon (lite version and full version) Game story: Two empires dispute the new continent of Tamaca. The Nothul Empire and their heavy troops occupy the north. The Republic of Ingeber and their privateers went inland and took over the Mystical Cities. You play the role of Jakkal, aspiring privateer from Ingeber. You've just arrived to Crab Bay to join your older brother Jekkel, a seasoned privateer who is in the Mystical City of Crisal, far inland in Tamaca.
×
×
  • Create New...