Jump to content

Search the Community

Showing results for tags 'follow'.

  • 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 15 results

  1. I do not find the error in this code anyone help me please. I'm doing a topdown game but I can not get the camera to follow the sprite player.... Sorry if I'm doing something wrong! this.Camera.follow (player, Phaser.Camera.FOLLOW_TOPDOWN); this does not work ! do not open anything; When I remove it everything works normal var config = { type: Phaser.CANVAS, width: 1920, height: 1080, physics: { default: 'arcade', acarde:{ //gravity:{ } debug: false } }, scene: { preload: preload, create: create, update: update } }; var game = new Phaser.Game(config); function preload () { this.load.image('ground', 'images/ground-smart.png'); //pedras this.load.image('stone1', 'images/stone-1.png'); this.load.image('stone5', 'images/stone-5.png'); //flores this.load.image('flor1', 'images/flor1.png'); this.load.image('flor2', 'images/flor2.png'); this.load.image('flor3', 'images/flor3.png'); //player this.load.spritesheet('player1', 'images/p-anim.png', { frameWidth: 128, frameHeight: 90 }); } function create () { this.add.image(960, 540, 'ground'); this.add.image(64, 430, 'stone1'); this.add.image(650, 80, 'stone5'); flores = this.physics.add.staticGroup(); flores.create(400, 350, 'flor1'); flores.create(220, 90, 'flor3'); player = this.physics.add.sprite(400, 300, 'player1'); this.Camera.follow(player, Phaser.Camera.FOLLOW_TOPDOWN); this.anims.create({ key: 'left', frames: this.anims.generateFrameNumbers('player1', { start: 1, end: 7 }), frameRate: 6, repeat: -1 }); this.anims.create({ key: 'turn', frames: [ { key: 'player1', frame: 0 } ], frameRate: 20 }); this.anims.create({ key: 'right', frames: this.anims.generateFrameNumbers('player1', { start: 1, end: 7 }), frameRate: 10, repeat: -1 }); cursors = this.input.keyboard.createCursorKeys(); this.physics.add.collider (player, flores); } function update () { if (cursors.up.isDown) { player.setVelocityY(-160); player.anims.play('left', true); } else if (cursors.down.isDown) { player.setVelocityY(160); player.anims.play('right', true); } else { player.setVelocityX(0); player.anims.play('turn'); } if (cursors.up.isDown && player.body.touching.down) { player.setVelocityY(-330); } }
  2. Hey dudes So I'm continuing along with my 3d project and I've been building a prototype scene in babylon in order to test the final experience and make a few decisions. Part of my test scene involves a helicopter going around in a circle, so in blender i created a bezierCircle, parented the helicopter to it and set the parenting mode to follow path. In blender this works great when running the animation. The big problem is of course (I soon discovered) that the babylon exporter does not support beziercircles and therefore ignores the path and the helicopter model (since it is now a child object of the beziercircle). So my question is; what is the expected way to set up things like follow path animations in Blender such that the babylon exporter will support it and babylon can play the animations automatically? Cheers!
  3. Hello I'm having an interesting problem with my camera, this is how my game looks without the camera following the player this is how it looks following the player... (the only good thing is that it actually follows the player) but I would like to know how to set up the bounds of the camera and to make sure it doesn't ... well do this. here's my code : scenes.scene3 = function(){}; //Player speed var link, vel = 150; //Map/Level var map; //Tiled Layers var floor, water,walls; //Object Tiled Layers var rocks var bushes1, bushes2, bushes3, bushes4; scenes.scene3.prototype = { preload: function (){ game.load.image('tiles', 'Assets/Sprites/Levels/zelda_01.png'); music = game.add.audio('openWorld'); music.addMarker('openWorld', 0, 16, true); game.renderer.resize( 1216/2, 800/2); }, create: function (){ //Game itself game.world.setBounds(0,0, 1216, 800); game.physics.startSystem(Phaser.Physics.ARCADE); map = game.add.tilemap('level_01'); map.addTilesetImage('tiles'); floor = map.createLayer('ground'); walls = map.createLayer('walls'); water = map.createLayer('water'); map.setCollisionBetween(0, 100, true, 'walls'); map.setCollisionBetween(0, 100, true, 'water'); //Objects layer related rocks = game.add.physicsGroup(); map.createFromObjects('rocks','ROCK','tiles', 48, true, false, rocks); rocks.forEach(function(rocks){rocks.body.immovable = true;}); bushes = game.add.physicsGroup(); map.createFromObjects('bushes', 'BUSHTOP', 'tiles', 37, true, false , bushes); map.createFromObjects('bushes', 'BUSHBOT', 'tiles', 35, true, false , bushes); map.createFromObjects('bushes', 'BUSHLEFT', 'tiles', 36, true, false , bushes); map.createFromObjects('bushes', 'BUSHRIGHT', 'tiles', 34, true, false , bushes); bushes.forEach(function(bushes){bushes.body.immovable = true;}); // music.play('openWorld', 0,1,true); // Player link = game.add.sprite((centerX-500), 100, 'LinkMovement'); link.scale.setTo(0.25, 0.25); link.animations.add('walkHorizontalRight', [6,7,8]); link.animations.add('walkHorizontalLeft', [9,10,11]); link.animations.add('walkVerticalDown', [0,1,2]); link.animations.add('walkVerticalUp', [3,4,5]); game.physics.enable(link); link.body.collideWorldBounds=true; //Life bar life = game.add.sprite((centerX-600), (centerY-675), 'lifeBar'); life.scale.setTo(0.15, 0.15); life.animations.add('fullHP', [0]); life.animations.add('twoHP', [1]); life.animations.add('oneHP', [2]); life.animations.add('Dead', [3]); cursors = game.input.keyboard.createCursorKeys(); var b1 = game.add.button(900,300, 'buttonFire', function() {fire();}); b1.scale.setTo(0.25,0.25); game.camera.bounds = (608,400); game.camera.follow(link); }, update: function (){ game.physics.arcade.collide(link, walls); game.physics.arcade.collide(link, water); game.physics.arcade.collide(link, rocks); game.physics.arcade.collide(link, bushes); if(cursors.up.isDown){ link.body.velocity.y = -vel; link.animations.play('walkVerticalUp', 9, true); } else if(cursors.down.isDown){ link.body.velocity.y = vel; link.animations.play('walkVerticalDown', 9, true); } else{ link.body.velocity.y = 0; link.animations.stop('walkVerticalUp'); link.animations.stop('walkVerticalDown'); } if(cursors.left.isDown){ link.body.velocity.x = -vel; link.animations.play('walkHorizontalLeft', 9, true); } else if(cursors.right.isDown){ link.body.velocity.x = vel; link.animations.play('walkHorizontalRight', 9, true); } else{ link.body.velocity.x = 0; link.animations.stop('walkHorizontalRight'); link.animations.stop('walkHorizontalLeft'); } }, fire: function(){ console.log('firing') var bullet = bullets.getFirstDead(); bullet.reset(link.x, link.y); }, drawHealthBar: function(){ if (hitPoints === 3) { life.animation.play('fullHP'); } else if (hitPoints === 2) { life.animation.play('twoHP'); } else if (hitPoints === 1) { life.animation.play('oneHP'); } else if (hitPoints === 0) { life.animation.play('Dead'); } } };
  4. Hi guys! I'm doing a 2D game with tiled map and I've run into a problem. When the group of objects (map layer and unit sprites) scaled, and camera is focused on sprite (by following with lerp), camera.view, or autoCull (or something else) gets some offset lag But all works fine with image map. You can uncomment the /* image map */ section in 'create' tab to check it out. Dont forget to comment the /* tile map */ section Just look: http://phaser.io/sandbox/edit/XNQoDGUq Buttons: LEFT ARROW - center camera on unit1 and scale group to 1.2 (if not zoomed); RIGHT ARROW - center camera on unit2 and scale group to 1.2 (if not zoomed); UP ARROW - unzoom (set group scale to 1); Spent last two days to fix this out, but have no more ideas.
  5. Hello everyone! First of all, thanks for the excellent forum! It's amazing. My question is, how to make and which the best way to make a "Light trail effect". I've make this image from photoshop to illustrate: The red dot is the point that the line shall follow. When the line becomes long, needs to fade out. I thought 2 possibilities to do it : Particles or slice and manipule a "shape" (texture), dividing in 3 parts, like : My doubt is, what is better? Or have other way to do... And, the Particles or Particles Storm from Phaser can do this? Sorry for my bad english Thanks for patience!
  6. Hi Everybody ! I'm working on a game with camera follow, and many plans on background. Is there a solution to make them moved at differents speeds ? To create parallax effect :). Thank you !! And sorry for my english ^^..
  7. I'm having an issue where my sprite position is not staying on top of my sprite. Please see this example i created to show the problem: http://phaser.io/sandbox/edit/FqrdczCN - (The yellow dot is sprite position. red dot is worldTransform) When the sprite is moved to the right and lower side of the map, the sprite position (yellow dot) moves away from the sprite. It seems to have something to do with the camera bounds. I've noticed if I full screen the game to be bigger than the size of the map, this problem does not happen. only when the camera is following the player AND the map goes off screen. Also I noticed that if i remove layer.resizeWorld() the problem disappears. This is interfering with my development because I need the sprites position to be accurate. Can someone tell me why this is happening?
  8. Hi, I made a new camera follow mode, because none of existing type is what i want. I dont know if it is a great feature to Phaser lib, but to me is what i want. The only problem in my update calc, is a flick when my sprite is moving. This is my code on game update (the camera default follow code is disabled): game.camera.x = Math.round(this.player.sprite.x - (game.camera.width / 2)); game.camera.y = Math.round(this.player.sprite.y - (game.camera.height / 2)); game.camera.bounds = new Phaser.Rectangle(this.player.sprite.x + (game.camera.width / 2), this.player.sprite.y + (game.camera.height / 2), , ); Can anyone have any tips?
  9. I have started a platform game very simple, just to teaching myself, following examples and tutorials. Already searched too much the annoying problem of camera follows, because my camera doesn't follow the player correctly. The problem is the sprite player move left to right and the camera start moving but not in the same speed, so the camera doesn't center and the sprite moving far from center to right, also the cameras still moving, but can't follow the sprite speed. function GameState() { Phaser.State.call(this);}GameState.prototype = Object.create(Phaser.State.prototype);GameState.prototype.constructor = GameState;GameState.prototype.preload = function() { 'use strict'; this.game.load.tilemap('map', 'static/map1.json', null, Phaser.Tilemap.TILED_JSON); this.game.load.image('tiles', 'static/tiles.png'); this.game.load.spritesheet('hero', 'static/hero.png', 34, 38, 14);};GameState.prototype.create = function () { 'use strict'; console.log('create'); // start physics system this.game.physics.startSystem(Phaser.Physics.ARCADE); this.game.world.setBounds(0, 0, 6400, 640); this.game.physics.arcade.gravity.y = 1000; this.player = new Player(this, 40, 4); this.game.stage.addChild(this.player); this.game.camera.follow(this.player); var map = this.game.add.tilemap('map'); map.addTilesetImage('tiles1', 'tiles'); this.layer1 = map.createLayer('layer1'); this.layer1.debug = true; this.layer1.resizeWorld(); this.layer2 = map.createLayer('layer2'); this.layer2.resizeWorld(); map.setCollision(130, true, "layer1", true);};GameState.prototype.update = function() { 'use strict';};GameState.prototype.render = function() { 'use strict';};function Player(game_state, x, y) { Phaser.Sprite.call(this, game_state.game, x, y, 'hero'); this.game_state = game_state; this.states = { WALKING : 'WALKING', IDLE : 'IDLE' }; this.facing = 'left'; this.life = 0; this.isAlive = false; this.name = 'Player'; this.currState = this.states.IDLE; console.log('Add player'); this.animations.add('idle', [1], 0); this.animations.add('walk', [0, 1], 6, true); this.animations.play('idle'); this.game_state.game.physics.enable(this, Phaser.Physics.ARCADE); this.body.collideWorldBounds = true; this.anchor.setTo(1); this.cursors = this.game_state.game.input.keyboard.createCursorKeys();}Player.prototype = Object.create(Phaser.Sprite.prototype);Player.prototype.constructor = Player;Player.prototype.changeState = function(newState) { if (newState === this.currState) { return; } this.currState = newState; console.log('Change state', newState); switch(newState) { case 'IDLE': this.animations.play('idle'); break; case 'WALKING': this.animations.play('walk'); break; }};Player.prototype.update = function() { //this.game_state.game.physics.arcade.collide(this.player, this.layer1); if (this.cursors.left.isDown) { this.scale.x = 1; this.body.velocity.x = -200; } if (this.cursors.right.isDown) { this.scale.x = -1; this.body.velocity.x = 200; } if (this.cursors.right.isDown || this.cursors.left.isDown) { this.changeState('WALKING'); } else { this.body.velocity.x = 0; this.changeState('IDLE'); }};
  10. Hello everyone. I'm new around here and i just started playing with Babylon js. I started working on a small project and i encountered some issues with the Follow Camera (which is amazing btw ). So, here's my problem: I have a character in the scene, i set the follow camera, i modified it a bit so it folows the caracter from behind. Now the issue is that when i set the camera target, everything i do is relative to the caracters feet (0,0,0) - rotating the camera around the object for example. How can i modify the pivot point to be the caracter's head or some point of the target object? Thanks in advance and excuse me for my poor english.
  11. Hey, I'm working on a vertical platformer game. The camera following the player worked fine, until I changed my world bounds to start at the bottom of the world and the player going up (first the world started at 0, 0). My player can jump, but the camera won't follow anymore. I've searched a lot about it but nothing could help me further. I'm just using: game.camera.follow(player);Hope anyone can help!
  12. Hi, after upgrating to latest Phaser v2.1.3 performance in camera.follow rapidly drops... Here is a example... Test steps: - after load click on "HRAJ"("hraj" means "play" in slovak language) - you will be forced to fullscreen - use your keyboard arrows and walk around with character Whats wrong? When camera is moving with character performance of app rapidly drops!!! This is not a problem in Phaser 2.0.7 but all version up to 2.0.7 are affected with this Expected behaviour In phaser v2.1.3 it should camera.follow performance fast as it is in Phaser v2.0.7 CAMERA FOLLOW IS FAST - v2.0.7 This link using v2.0.7 - it's fast http://www.peteroravec.com/ CAMERA FOLLOW IS EXTREMELY SLOW - v.2.1.3 This link load Phaser 2.1.3 - and on camera follow its extremely slow http://www.peteroravec.com/?phaser213=true Code is the same but different versions of Phaser, any suggestions? Thanks for support
  13. Hi, I'm posting this because I've been doing a lot of searching and I can't seem to find a solution to this problem. I'm sorry if this is something generic that I've missed. The problem: When I start to move my player character, the character remains in the centre (good), but the tiled background doesn't scroll with the player. This means that the player can run and jump on platforms, but they are "invisible" as the background hasn't moved. I'm using a Tiled generated level in a platformer. The camera is following the player using - this.camera.follow(player); The level was created in tiled, it uses a 200 x 200 image split into a grid of 20x20 tiles. The level itself is 64 x 40 tiles, so if the full resolution of the tiled level is 1280 x 800. The resolution of the main phaser game is 640 x 400. This means that the game should scroll in both x and y. I'm just doing this as a test so far and I may want to produce larger levels later. Does anyone have any clues as to why this might be happening? Thanks, Dan
  14. Hi, I'm new in the community and I love phaser JS. I'm developing a platform game. I like to comment my problem with "intelligence projectiles" I would mention to my problem with "smart missiles". Basically I do not know how to perform this task. I am able to handle sprites with animations but I do not know as provide them with "intelligence" to attack the player. I want the enemy attack the player shooting projectiles that follow. I attach a picture with my problem. Any idea? A greeting.
  15. Hi everyone, Does someone know how I could automatically follow all topics of a specific forum? I follow a forum, so I get notifications for all its new topics and for all topics for which I replied to but I am not notified when someone replies to a topic that I don't follow or for which I never replied to. I could manually click on "follow this topic" for every single new topic but let's say I would prefer something more automatic... Thanks for helping
×
×
  • Create New...