Jump to content

Search the Community

Showing results for tags 'infinite scroller'.

  • 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. I'm playing around with an infinite scroller game idea (think Temple Run) on the basis that the player stands still, and the terrain moves towards the camera, giving the illusion of forward motion. I added some simple random box meshes on top of the path that the user needs to navigate around (game over otherwise), and some gaps in the ground that the player can fall thru (game over). Since i need collision detection and basic player gravity I set up using CannonJS. That seems to work OK: the player would fall through the gaps, but for some reason the hit detection for the obstacles would bug out, sometimes letting the player mesh go halfway thru (imposter out of sync with mesh). For the motion of the path blocks i simply did mesh.position.z -= .1 in each render loop. After reading some more on this it seems like manipulating physics objects like this is not a good idea (should use impulse/force instead)? Funny thing is, if I turned down the speed to a crawl the imposter worked as it should and seemed to match up with the mesh. If I can't use this approach to moving the ground, what would be a better solution? I also thought about setting a linear velocity in the ground, but since its mass is set to 0 this has no effect. I think my main question is this: How can I implement a simple gravity + jump functionality manually (colliding with a flat predicable/same height ground)?
  2. I'm creating an infinite scroller and (among other things) I'm having trouble with deducting player lives. I've looked at various tutorials, but most of them seem to kill the player whenever they hit an obstacle. Ideally, I'd like to deduct a life from the player until they have no more lives. The problem I'm experiencing is that I'm checking overlap with the player and a pool of enemies (btw, works the same way if I check for collision). In the callback, I only want to deduct a life the first time the player comes in contact with the enemy. What's happening now is that a single contact will destroy all the hearts. I've tried using a counter, but that doesn't seem to work well as any attempt to reset it seems to be happening too quickly. I've also tried to use signals, but they seem to result in the same behavior as using the callback. The code looks like this: // In update this.game.physics.arcade.overlap(this.player, this.enemiesPool, this.hurtPlayer, null, this); // Callback hurtPlayer: function(player, enemy) { console.log(this.hitCounter); //do this during overlap this.isHit = true; this.canShoot = false enemy.play('attacking'); player.play('hit'); //only destroy a heart the first time you contact the enemy //enemy should detract 1 heart at most // if (this.hitCounter <= 0) { // this.destroyHeart(); // } // this.hitCounter++; this.destroyHeart(); //enemy.kill(); }, //Destroy heart destroyHeart: function() { console.log(this.myLives); switch(this.myLives) { case 4: this.life4.destroy(); break; case 3: this.life3.destroy(); break; case 2: this.life2.destroy(); break; case 1: this.life1.destroy(); break; } this.myLives--; }, Any suggestions?
  3. Howdy all, I've looked everywhere but I can't seem to find an answer. I'm making an infinite scroller. The platforms are automatically generated and they are made up of a pool of floor sprites nested into a pool of platforms (groups of floor sprites). For example: // Creating platforms in Game.js createPlatform: function(){ var nextPlatformData = this.generateRandomPlatform(); if (nextPlatformData) { this.currentPlatform = this.platformPool.getFirstDead(); if (!this.currentPlatform) { this.currentPlatform = new SupRun.Platform( this.game, this.floorPool, nextPlatformData.numTiles,this.game.world.width + nextPlatformData.separation, nextPlatformData.y, -this.levelSpeed, this.coinsPool, this.enemiesPool, this.enemySprite, this.player, false); } else { this.currentPlatform.prepare( nextPlatformData.numTiles, this.game.world.width + nextPlatformData.separation, nextPlatformData.y, -this.levelSpeed, this.coinsPool, this.enemiesPool, this.enemySprite, this.player, false); } this.platformPool.add(this.currentPlatform); this.currIndex++; } } //Creating groups of floor sprites in Platform.js prefab SupRun.Platform.prototype.prepare = function(numTiles, x, y, speed, player) { //console.log(speed); this.alive = true; var i = 0; while(i < numTiles){ var floorTile = this.floorPool.getFirstExists(false); if (!floorTile){ floorTile = new Phaser.Sprite(this.game, x + i * this.tileSize, y, 'floor'); } else { floorTile.reset(x + i * this.tileSize, y); } this.add(floorTile); i++; } //set physics properties this.setAll('body.immovable', true); this.setAll('body.allowGravity', false); this.setAll('body.velocity.x', speed); this.addCoins(speed); this.addEnemies(speed, this.player); }; The player collides with the top of the of the platforms just fine. However, I would like the player to hit the side of the wall and just fall straight down, instead of falling through. Is this possible?
×
×
  • Create New...