Search the Community
Showing results for tags 'Ninja Physics'.
-
I have started to make a game making use of illuminated.js and started with arcade physics (http://www.pixelshader.co.uk/illuminate/). I moved on to using tiles with more complex shapes and moved onto ninja physics to accommodate this. I managed to set the slope map correctly and the collision works but I have a few questions: 1. I cant seem to move up slopes. This can be seen when playing the game (currently a small test) when moving to the right. How can i get the character to move up the slope? 2. Is it possible to change the sprites AABB body size with ninja physics? (can turn on debug body using Q in the game) 3. With arcade physics it was possible to do 'body.blocked.down' to test if a sprite was on the ground, to test prior to jumping. Is something similar possible with ninja physics? Thank you for your help!
-
Hey guys i have a drag and drop game, where i will drag and drop an object and then click a button on the screen to initialize the physics. I have to disable the ninja physics on the object whilst it is being dragged and so this is why i need a collision between this object and another when the button is clicked. Any ideas are much appreciated.
-
Hi, Programming on my game, i came across a very strage behavoir. For some reason my body does not react to velocity. It can be set, but it does not have any effect. MoveLeft or MoveRight on the other hand works fine. Is this a commen bug, or am i just missing something? Help would be greatly appreciated. Here is some of the code I use: var player;var ground;var map;var levelLayer;var objectsLayer;var bg;var spikes;var collision_tiles;var move_distance = 50;var jump_height = 10000;var playState = { create: function() { // cursor cursors = game.input.keyboard.createCursorKeys(); // Create Background and fix camera on background bg = game.add.sprite(0, 0, 'background'); bg.fixedToCamera = true; // Create map from tileset and JSON & add Collision & add .png's map = game.add.tilemap('test2'); map.addTilesetImage('tiles_spritesheet','tiles'); map.addTilesetImage('magicBoni','magicBoni'); map.addTilesetImage('Map','Map'); map.addTilesetImage('spike-up','spike-up'); map.addTilesetImage('black-tiles64','black-tiles64'); // Add layers to map levelLayer = map.createLayer('Kachelebene 1'); levelLayer.resizeWorld(); map.setCollisionBetween(1,3000,true,levelLayer); // Create slope map var slopeMap = {'1':1,'2':1,'3':2,'4':3,'5':4,'6':5,'7':6,'8':7,'9':8,'10':9,'11':10,'12':11,'13':12,'14':13,'15':14,'16':15,'17':16,'18':17,'19':18,'20':19,'21':20,'22':21,'23':22,'24':23,'25':24,'26':25,'27':26,'28':27,'29':28,'30':29,'31':30,'32':31,'33':32}; collision_tiles = game.physics.ninja.convertTilemap(map,levelLayer,slopeMap); // Player settings player = game.add.sprite(0, 20, 'player'); game.physics.ninja.enableCircle(player,player.width/2); game.physics.ninja.enableBody(player); game.physics.ninja.enable(player); player.body.bounce.y = 0.8; game.physics.ninja.gravity = 0.3; game.camera.follow(player); game.add.sprite(0, 0, 'foreground'); }, update: function() { for (var i = 0; i < collision_tiles.length; i++) { player.body.circle.collideCircleVsTile(collision_tiles[i].tile); } if (cursors.left.isDown) { player.body.moveLeft(move_distance); } else if (cursors.right.isDown){ player.body.moveRight(move_distance); } // DOES NOT WORK! if (cursors.up.isDown && player.body.touching.down == true) { player.body.velocity.y = jump_height; } }}
- 2 replies
-
- Ninja Physics
- phaser
-
(and 2 more)
Tagged with:
-
Hi, I'm developing a quick framework to let at risk inner city youth design video game levels for a workshop I am leading next week. I have been playing around with phaser for about a month and I've got a decent handle of P2 and Arcade, but as I looked closer to what I'd need to be able to do to let the kids just draw levels on paper and then transfer that into a framework I've settled on Ninja because it allows for bounds, one way platforms and the overlay callback which lets them include some pretty standard platformer mechanics that I predict they'll want to include. So I am just having a little bit of trouble getting the slopemap to work with a tilemap. I am using the default ninja tilemap and then I am planning to import the art the kids draw overtop of the tiles so it looks like their characters are walking on the actual sprites. I am having a hell of a time actually getting this to work. Any help would be appreciated. The limited examples for Ninja physics is really draining. I really want to have a working prototype by the time I present the workshop. I'm going to be asking a lot of questions this week because I really want to present something fun for the kids to fuel their interest in computers (which are awesome) Cheers
- 4 replies
-
- ninja physics
- collision
-
(and 1 more)
Tagged with:
-
Hi all, Apologies for what is sure to be a noob question, but I'm trying to switch from Arcade physics to Ninja physics and finding some things that I expected to work properly are not - For instance, I enable a simple AABB physics object by basket = game.add.sprite(game.world.centerX, game.world.height - 100, 'basketimage');game.physics.ninja.enableAABB(basket);..which seems to give the object physics properties and it immediately falls offscreen due to gravity. I try and adjust properties such as basket.body.drag.x = 50;basket.body.maxVelocity.x = 250;basket.body.gravity.y = 0;... to no avail. I get error messages such as "Cannot set property 'y' of undefined Does anyone know what I'm doing wrong? Am I adding/enabling a physics body incorrectly? Thanks for your assistance.
- 2 replies
-
- ninja
- ninja physics
-
(and 4 more)
Tagged with: