Jump to content

Search the Community

Showing results for tags 'fixedtocamera'.

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

  1. I'm currently experimenting and porting A game from v2 to v3 (fun). Is there any way we can lock A GameObject to A camera, similar to fixedToCamera? Mostly for locking UI related objects to the main viewport for instance.
  2. Hey guyz. collide method doesn't work when spirite is fixed to camera. I attached an image to show you what is the problem. Here's my code: var playState = { xPosition: 0, create: function(){ game.world.setBounds(0, 0, 500, 5000); //Create the World this.createWorld(); //Change background color game.stage.backgroundColor = "#ffffaf"; //Add Player to the World this.player = game.add.sprite(0,0,"player"); game.physics.arcade.enable(this.player); this.player.anchor.setTo(0.5,0.5); this.player.fixedToCamera = true; this.xPosition = game.world.centerX; this.player.cameraOffset.setTo(this.xPosition, game.world.height - 300); //Access to Arrow Keys this.cursor = game.input.keyboard.createCursorKeys(); //Initialize this.emitter = game.add.emitter(0, 0, 20); this.emitter.makeParticles('tear'); this.emitter.setYSpeed(-150,150); this.emitter.setXSpeed(-150,150); this.emitter.gravity = -20; game.camera.follow(this.player); }, update: function(){ game.physics.arcade.overlap(this.layer,this.player,this.playerDie, null, this); game.physics.arcade.collide(this.layer,this.emitter); this.movePlayer(); }, createWorld: function(){ //Starter Map this.startMap = game.add.tilemap('start_map'); this.startMap.addTilesetImage('rect'); this.layer = this.startMap.createLayer('Tile Layer 1'); this.layer.resizeWorld(); this.startMap.setCollision(1); //game.camera.y += -200; }, movePlayer: function(){ if(this.cursor.left.isDown){ this.xPosition += -20; this.player.cameraOffset.setTo(this.xPosition, game.world.height - 300); }else if(this.cursor.right.isDown){ this.player.body.velocity.x = 150; }else{ this.player.body.velocity.x = 0; } }, playerDie: function(){ if(!this.player.alive){ return; } this.player.kill(); // Set the position of the emitter on the player this.emitter.x = this.player.x; this.emitter.y = this.player.y; // Start the emitter, by exploding 15 particles that will live for 600ms this.emitter.start(true, 900, null, 15); game.time.events.add(1000, this.startMenu, this); //Start Menu },};
  3. I would like to place my UI elements on top of all other sprites/groups. My current approach was to add a new group, place this on top of everything else and set fixedToCamera = true, but this gives me a weird result. Everything in this group does seem to be placed differently, and more fixedToCamera than some other stuff, but all the transformation I've done to the master "world" group seem to also apply to this group. How can I truly add UI graphics to the game without any previous matrices/translations applied to them, so they are placed solely in camera-space. I realise I could add another layer of group over everything else and then treat one of them as the world, and have everything but UI in this group, but that would leave me with two groups called "world". Though, this is going to be my solution unless there's an easy fix available. Perhaps I am just using fixedToCamera wrong?
  4. helo. pls someone help me. i wanna place a bg to my screen with auto scrilling infinitely. i tryed this code game.bg = this.game.add.tileSprite(0,0,800,480,'background'); game.bg.autoScroll(-100,0); and it looks like fine for the first 800 pixel but not inifinite for the whole gameafter i tried to add this code for this game.bg.fixedToCamera = true; and now i have the bg for the whole game and it is autoscrolling but when i move with my hero the bg scrolling is not scrolling well relatively to my vision. sry for my terrible english and thx for any advice!
  5. Hi there. It seems fixedToCamera works fine for me when I don't scale down the image at all (it is a background sky image), but the second I scale either the group containing the sky or even the whole game.world the background stops following the camera. What I would like is when I zoom out for the sky to expand, but then remain fixed to the camera afterwords when the camera moves etc... Thanks for any help/suggestions. -DRG
  6. Hello! I need to set a graph of camera movement. I tried with this code but it does not work well this.lifeGraphics.lineStyle (10, 0x33FF00); this.lifeGraphics.moveTo (30, 460); this.lifeGraphics.lineTo (60, 460); this.lfeGraphics.fixedToCamera = true;
×
×
  • Create New...