-
Content count
6 -
Joined
-
Last visited
About samcrowleymusic
-
Rank
Newbie
Contact Methods
-
Twitter
samxcrowley
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Enable-
I'm trying to offset the camera's follow on my player so that the player is closer to the bottom of the screen rather than being right in the center of the height. I'm using this code as per the example: game.camera.follow(player, Phaser.Camera.STYLE_PLATFORMER, 0.1, 0.1, 0, 300); And it does absolutely nothing.
-
All I would like to know is the best way for rendering rectangles, circles, coloured things on to the screen which are fixed to the camera in a GUI. I've searched and searched and I can't find how to do this. Can anyone let me know what the best way is to do this? It seems like there should be some easy way and I'm just missing something. And how do I make it render something each frame, and at the end of each frame the screen is cleared so I'm not left with everything that's been rendered previously hanging around on the screen?
-
I'm checking collisions between an emitter and my tilemap layer. What I want to happen is that when they collide, the particle gets destroyed and the tile it collides with is removed. How do I get the specific particle and tile as variables to work with in the callback function? EDIT: I'm trying this and getting an error: game.physics.arcade.collide(this.asteroidEmitter, layer, function(obj1, obj2) { this.asteroidEmitter.removeChild(obj1); }); Uncaught TypeError: Cannot read property 'removeChild' of undefined
-
samcrowleymusic started following Player class not being added in
-
Hi there, Previously I had my player being created inside of the level state, but now I'm working on separating the player into its own object which I can create an instance of in the play state. Here's my two files: Player.js: Player = function(game, x, y) { Phaser.Sprite.call(this, game, x, y, 'player'); this.anchor.setTo(0.5, 0.5); this.game.physics.enable(this); } Player.prototype = Object.create(Phaser.Sprite.prototype); Player.prototype.constructor = Player; Player.prototype.update = function() { this.handleInput(); } Player.prototype.handleInput = function() { if(keys.D.isDown) this.body.velocity.x += 1; if(keys.A.isDown) this.body.velocity.x -= 1; if(this.body.onFloor() && keys.SPACE.isDown) this.body.velocity.y -= 4; }; playstate.js: var playState = { create: function() { this.world.add(slickUI.container.displayGroup); game.stage.backgroundColor = "#1e1e1e"; game.physics.arcade.gravity.y = 400; map = game.add.tilemap('map1'); map.addTilesetImage('moontileset', 'tileset'); layer = map.createLayer('Tile Layer 1'); layer.resizeWorld(); map.setCollisionBetween(1, 16); player = new Player(game, 128, 96); game.camera.follow(player, Phaser.Camera.FOLLOW_LOCKON, 0.1, 0.1); }, update: function() { game.physics.arcade.collide(player, layer); player.update(); } } When I run the game, I get no errors, but the player isn't appearing on screen. Everything else works fine. The methods inside player are being called, everything. I don't know what I've done wrong.
-
Hey there, I'm trying to render a hotbar to the screen but it follows the camera and moves along as the camera moves. I want it to stay still on the screen and be separate from the world's physics and camera's positions. What's the best way to do this?
-
Hello! I've just released a five song EP and I think a couple of the tracks could work for a game. If they're not right for you but you like the style, I can produce something a little more specific for you and your game. Check out the EP here (Tracks 2 and 3 in particular): open.spotify.com/album/0ZrExaHUvZApb5pcZRNYO3 I have played piano for over ten years and guitar for a year. I can make tracks similar in style to the above, but other styles can be discussed. Thanks everyone!