Search the Community
Showing results for tags 'phaser ce'.
-
Currently working on my first bullet hell game, using Phaser CE. Been prototyping some new weapons and mechanics lately, have been posting a lot of updates in other channels. See main site: nunguns.com. A description of the game-to-be: Nuns with Guns is a gothic, dungeon-crawler-bullet-hell that celebrates blowing away evil monsters with extreme prejudice (in order to rescue wee orphan children from demons). Eventually, our hero will blast her way through 8 stages of cartoon-y gore and violence in order to rescue her retinue of kids--recently kidnapped from St. Germane's school for the innocent. While there is a playable prototype, and hoping to test gameplay by end of March CY19, a lot more work will yet to go into the coding and level creation. We are looking for early support (mainly to pay for art), please see more info at our patreon page. Some very-early footage: Some NEWER footage available on Facebook, Instagram
-
Hi guys! Main character in my game is this cat: Cat is composed from two parts - the torso and the head - and for each part I want to have physics body enabled, therefore I decided all parts will be inside a group. During the gameplay, I apply certain amount of velocity to the cat torso and cat then should rotate around its own axis, clock-wise and counter clockwise. I chose the approach to apply velocity to the torso and I want to position the head according the torso in the update method. Basically I want to achieve the same behaviour as Sprite.addChild() (add head as a child of a torso), but I want to do it in a group. I imagine basic (pseudo)code should look like this: export class Cat extends Phaser.Group { private _torso: Phaser.Sprite; private _catHead: Phaser.Sprite; private _torsoHeadDistance: number; public constructor(game: Phaser.Game, startPosY: number) { super(game); //torso this._torso = game.add.sprite(game.world.centerX, startPosY, "torso"); this._torso.anchor.setTo(0.5); this._torso.scale.setTo(0.5); //head this._catHead = game.add.sprite(this._torso.x, this._torso.top, "head"); this._catHead.anchor.setTo(0.5, 0.7); this._catHead.scale.setTo(0.3); this.add(this._torso); this.add(this._catHead); game.physics.enable(this._torso, Phaser.Physics.ARCADE); game.physics.enable(this._catHead, Phaser.Physics.ARCADE); //Get the distance between both parts this._torsoHeadDistance = this.game.physics.arcade.distanceBetween(this._torso, this._catHead, true); } //This will be called when player interacts with the game public AddVelocity(angle, speed, angularVel: number) { this._game.physics.arcade.velocityFromAngle(angle, speed, this._torso.body.velocity); this._torso.body.angularVelocity = angularVel; } //Called from update each frame public UpdatePosition(){ //pseudo code this._catHead.position = this._torso.position + _torsoHeadDistance; this._catHead.rotation = this._torso.rotation; } } Basically I just want retain the same distance between both sprites in the group within the time. The problem is that I am not able to figure out the code which should be in UpdatePosition() method. I know it should be something with vectors and normalizing, but I already spent few hours solving this without success. Can someone point me closer to the solution, please? I start to be desperate... Thanks in advance!
-
I want to implement a bitmapData property to skew my sprite, so anybody help me out there..? need to know how to implement search docs in our game..?
-
Hi All I've been working on a top down endless runner , where the player jumps from one platform to another and should not leave the screen. How to make a platform move horizontally I'm spawning platforms and adding x and y velocity its working but is it a right of doing it ? if not how to make it look better this.initX = this.x; this.body.velocity.y = -200; platform.prototype.update = function () { if (this.moving) { if (this.x > (this.initX + this.width)) { this.speed = -200; } if (this.x < (this.initX)) { this.speed = 200; } this.body.velocity.x = this.speed; }
-
Hi! I am using Phaser CE, and here is some code: var level1 = { map:{ size:48, w:36, h:6, layout:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2] }, create: function(){ game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; game.physics.startSystem(Phaser.Physics.ARCADE); game.stage.backgroundColor = "#0ff"; game.renderer.renderSession.roundPixels = true; game.world.resize(this.map.size*this.map.w,this.map.size*this.map.h); this.background = game.add.tileSprite(0,0,game.world.width,game.world.height,'bg'); this.background.scale.setTo(3,3); this.ost = game.add.audio('music'); this.ost.loop = true; this.ost.play(); this.tiles = []; var j = 0; for(var i = 0;i<this.map.layout.length;i++){ if(this.map.layout[i]!=0){ switch(this.map.layout[i]){ case 1: this.tiles[j] = game.add.sprite((i%this.map.w)*this.map.size,Math.floor(i/this.map.h)*this.map.size,'tile2'); case 2: this.tiles[j] = game.add.sprite((i%this.map.w)*this.map.size,Math.floor(i/this.map.h)*this.map.size,'tile'); } this.tiles[j].width = this.map.size; this.tiles[j].height = this.map.size; game.physics.arcade.enable(this.tiles[j]); this.tiles[j].body.immovable = true; j++; } } player.create(); game.camera.follow(player.sprite,0.4,0.4); }, update: function(){ for(var i = 0; i < this.tiles.length; i++){ game.physics.arcade.collide(player.sprite,this.tiles[i]); } this.orientationChange(); player.render(); this.background.tilePosition.y += 0.25; }, orientationChange: function(){ game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; } } That was my player sprite colliding with a 1-D tilemap array. My problem is this -- When the player jumps, or isn't near the lower half, it looks normal(first screenshot. When it collides with the ground tiles (labeled 1 or 2) the camera acts as if I've touched the bottom of the screen, instead of showing the sprite on the tile, centered...(second screenshot) Please help! I am using Phaser from just a week, and this is a peculiar issue. There is a sample game at smvaidya.itch.io/DuskMite That map with tiles all over worked just fine but the one tiles which were set as floor (3 rows!) don't show up. They are under the screen. Why?
-
Hi guys, I was looking for a Phaser boilerplate, simple, clean to get me started but what I've found on the web was outdated, too complex or didn't do the right thing (at least for me) so I've decided to create my own. The Phaser boilerplate that I've put together comes with: - the latest version of Phaser CE 2.9.4 - TypeScript - Howler.js 2.0.7 (an awesome audio library) - can be removed if one does not need it - Webpack 3.10.0 - ... and few things to get a game up and running in no time Some of the awesome features: There is a integrated TypeScript linter that checks your code for readability, maintainability, and functionality errors (we need to code proper ). The code is watched so any change you make the browser refreshes (unless you have errors in your code). I've added a command to pack your code (minify, uglify, comments removal, console.log removals, etc). The uglify process is only applied on your custom code, not on vendor library so that you won't end up with extra MBs in your final build. The boilerplate is available here: https://github.com/numbofathma/phaser-typescript-webpack Let me know what you think! Hope it will be useful for the community!
- 2 replies
-
- typescript
- howler
-
(and 3 more)
Tagged with:
-
Hello everyone, I am trying to make the screen scale automatically based on the browser window. So I used the scale variable in world to scale it. I was trying to center it so I used the following code: this.world.x = Math.floor((this.game.width - Global.SCALE * Global.WIDTH) / 2); this.world.y = Math.floor((this.game.height - Global.SCALE * Global.HEIGHT) / 2); which didn't work nothing on the screen moved, I tried world.position.x/world.position.y and world.left/world.top and still nothing changed. Any help?
-
I am attempting to apply force manually to a sprite that has a P2 physics body. My hope is to achieve the designable jump described by Kyle Pitmann in his GDC Talk below. In this he derives equations for a jump arc that are controlled by the height, footspeed, and how long the jump should last. It will give you a gravitational force and an initial velocity to achieve those parameters. Everything I do to try and set a manual force on the P2 body is being ignored. Here is what I have: Gravity on the body is disabled via body.data.gravityScale = 0 I then try and initiate a jump using my precomputed initial velocity and gravitational constant as follows: let vx = config.WALK_SPEED sprite.body.force.y = this._jump_grav_start * vx * vx sprite.body.velocity.y = this._jump_vel_start * vx Afterwards I dump 'force' to the console and it is always zero no matter what I try to set it to. Am I just missing something fundamental here about how you apply a force in P2? Seth B. )
-
Hi, I am trying to make a menu which lets the user bind the in-game inputs. But I have no idea how to do that... Maybe there is a way to detect which input he presses and then use this information when creating input... Thanks beforehand.