Jump to content

Search the Community

Showing results for tags 'Phaser Objects Json Gravity'.

  • 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 1 result

  1. Ok So lets start by saying that is an amazing resource. I have done about 8 tutorials so far. I started to write a simple game. I wanted to expand on the first Phaser tutorials on the repository. Please consider that i have extremely limited experience when it comes to coding. The last time i coded was back when MUD were popular (56k? Ports?) text games pvp were so much more interesting. So i have mashed code examples over and over and over. I have done testing and research for each feature i want to add. I am a little bit stomped at the movement. I want to add gravity to my stars, that I have converted from objects in a Tiled Json map. I have converted the objects into the star32.png with success but i am not able to apply gravity to the stars. I am sure is because i am attempting to add gravity to all of the items create at the wrong time. Could someone help with this issue? or is there a better way to apply movement to the star? I bought and the read the tween book, so maybe that is a solution here but i am not experience enough yet to apply that. PS This is an incredible community and cant wait to be able to contribute something decent. var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });function preload() { game.load.tilemap('maze', 'assets/maze_star.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('tiles', 'assets/tile_sprite_star.png'); game.load.image('star', 'assets/star32.png'); game.load.spritesheet('dude', 'assets/dude.png', 32, 48);}var starsvar score = 0;var scoreText;var player;var map;var tileset;var layer;//var p;var cursors;function create() { game.physics.startSystem(Phaser.Physics.ARCADE); game.stage.backgroundColor = '#787878'; var map = game.add.tilemap('maze'); map.addTilesetImage('tile_sprite_star', 'tiles'); // 14 = ? block // map.setCollisionBetween(14, 15); map.setCollision(2); layer = map.createLayer('layer1'); //layer = map.createLayer('layer2'); // Un-comment this on to see the collision tiles // layer.debug = true; layer.resizeWorld(); // The player and its settings player = game.add.sprite(32, game.world.height - 150, 'dude'); // We need to enable physics on the player game.physics.arcade.enable(player); // Player physics properties. Give the little guy a slight bounce. player.body.bounce.y = 0.2; player.body.gravity.y = 300; player.body.collideWorldBounds = true; // Our two animations, walking left and right. player.animations.add('left', [0, 1, 2, 3], 10, true); player.animations.add('right', [5, 6, 7, 8], 10, true); game.camera.follow(player); stars = game.add.group(); stars.enableBody = true; // And now we convert all of the Tiled objects with an ID of 34 into sprites within the coins group map.createFromObjects('Object Layer 1', 6, 'star', 0, true, false, stars); //stars.body.gravity.y = 300; scoreText = game.add.text(16, 16, 'score: 0', { fontSize: '32px', fill: '#000' }); cursors = game.input.keyboard.createCursorKeys();}
×
×
  • Create New...