Search the Community

Showing results for tags 'phaser'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 2,330 results

  1. I'm a newbie with Phaser tile maps. I've created a simple Mario-esque platform game where the player can jump around and land on platforms. This all works fine, but now I'm trying to add some "walls" to the level which the player should not be able to pass through horizontally, and can't figure out how to get this behavior working (see attached illustration for better explanation) Here's the code I'm using to read the tilemap data and set up collision: pf.map = pf.game.add.tilemap('level2'); //the first parameter is the tileset name as specified in Tiled, the second is the key to the asset pf.map.addTilesetImage('tiles_spritesheet', 'gameTiles'); //create layers pf.blockedLayer = pf.map.createLayer('blockedLayer'); pf.walls = pf.map.createLayer('walls'); //collision on blockedLayer pf.map.setCollisionBetween(1, 5000, true, 'blockedLayer'); pf.map.setCollisionBetween(1, 5000, true, 'walls'); The "walls" layer should collide with the player on all sides, and the "blocked" layer should only collide on the top. Currently both the "walls" layer and the "blocked" layer are colliding with the player only on the top. Any help or advice very much appreciated!
  2. Hey guys, I am developing this draft game demo and I need some advice/ feedback on some tips to make the collision a bit better. I'm using loadPolygon to load a custom body shapes for this sprite object and responding to collisions using onBeginContact to applyImpulse to the ball on a SPACEKEY.onDown The following is the code player.body.collides(ballCollisonGroup, this.headerBall, player) headerBall(bodyA, bodyB, shapeA, shapeB, equation) { let duration = 10; let localX = equation[0].contactPointA[0]; let localY = equation[0].contactPointA[1]; let forceX = 0.12 * this.headMass; let forceY = 0.8 * this.headMass; if(this.headerKey.isDown) // only if see is down apply additional force { duration = Math.min(this.headerKey.duration, 500); // apply time based on how long key pressed forceY = (1 * this.headMass).toFixed(2); // apply force of 1 velocity x mass of head (.53) forceX = (1 * this.headMass).toFixed(2); let impulse = [(forceX * duration), (forceY * duration )]; // calculate impulse bodyA.applyImpulse(impulse, localX, localY ); // apply it to ball } } I'm not sure if I am doing it right as I am not verse in Math Physics but i would like some feedback on the following: - Is my formula accuarate? Can I set varying impulses based on the contact shape? There is a sort of glitch if the ball comes into contact with his shoes and the ball ends up in the middle of his body which gets stuck. How can I avoid this? The key down condition seems to be glitchy is there anyway to make this a bit more "safe" to detect and capture? I need to apply some force to the ball ONLY when the space key is pressed. Thank you in advance for your feedback.
  3. Hey all, I'm trying to filter an entire group, but I can't seem to succeed, where applying that same filter to a sprite instantly works. I'm working on my first Typescript project and I like it a lot! I have a MainGame class (mainGame.ts) which extends Phaser.State and I have a Container class (container.ts) which extends Phaser.Group When I apply a filter to a sprite that I simply added like: this.body = this.add.sprite(0, 0, 'bgBase'); this.body.filters = [ new Phaser.Filter.BlurY(this.game, null,'') ]; the blur filter is applied. Now when I try to apply the filter to a container which contains Sprites, like: this.container = new Container(this.game); this.container.filters = [ new Phaser.Filter.BlurY(this.game, null,'') ]; does NOT work. But when I apply the filter directly to a Sprite inside the container, like: this.container.someSprite.filters = [ new Phaser.Filter.BlurY(this.game, null,'') ]; the filter is applied as expected. I must be overlooking something important for how I create or add the group, but I keep missing it. I hope somebody has an idea about where to look. Help will be much appreciated!
  4. Hello I started to study this tutorial: Advanced Phaser and TypeScript Projects I want to write a code on JSFiddle. I started here: https://jsfiddle.net/8Observer8/bjss7bwj/ But I see the error in console: _super is not defined Please, help me.
  5. I was developing a phaser game that is remade from the Zenva Phaser Tutorial. I did some work on it last night, checked it was working and went to bed. Now this morning it isn't working! Instead of me having to explain, my game is https://felixdebug.neocities.org/ no input is working and he no longer collides with floor, in the way I set it up! Please help me. Code is here: https://github.com/NectarineGames/PhaserGame/ Any help appreciated!
  6. We have a ton of mini-projects (.5-2 weeks, generally), and we are looking for interested devs. They should all be in Phaser, leverage atlas files, and use our general code structure (we have pretty much an endless amount of projects, so once you get the rhythm, there's plenty of repeat work). If you are interested, shoot me a line on skype with any links you have to past work (jessemanuel415). -Jesse
  7. Hello everybody! I created a little scene with walls. Bottom wall is solid. But left and right are not. Why? Can you please help me? preload: function() { game.load.image('mario', 'images/mario.png'); game.load.image('WallH', 'images/wallH.png'); game.load.image('WallW', 'images/wallW.png'); }, create: function() { game.physics.startSystem(Phaser.Physics.ARCADE); game.stage.backgroundColor = "3984db"; game.physics.arcade.gravity.y = 1200; this.cursor = game.input.keyboard.createCursorKeys(); this.mario = game.add.sprite(game.width / 2, game.height / 2, 'mario'); this.mario.anchor.setTo(0.5,0.5); this.mario.scale.setTo(0.15,0.15); this.walls = game.add.group(); this.walls.enableBody = true; this.walls.enableBody = true; this.downWallH = game.add.sprite(0, 540, 'WallH', 0, this.walls); this.leftWallW = game.add.sprite(0,0, 'WallW', 0, this.walls); this.rightWallW = game.add.sprite(822,0, 'WallW', 0, this.walls); game.physics.arcade.enable(this.mario); this.walls.setAll('body.allowGravity', false); this.walls.setAll('body.immovable', true); }, ...
  8. Ahok has become a Kungfu Master. Get ready for rat attacks in the Jakarta city. wreck them all with kungfu style to save the city. Test your reflexes and break the records from around the world. Features: Addictive arcade game play. Fight hundreds of enemies every minute. funny sound effect and voices. Screenshot: Game Link(Please help rate and comment for both version. thanks ): HTML5: here and here Android If you are interested with HTML5 version. it's also available for non-exclusive license. Please contact me at smilesoft [at] live.com and here is the list of my latest HTML5 games(available for licensing): HTML5 games list Thanks.
  9. Here's me giving back to the community by sharing my own knowledge and adventure in Phaser: New: Jan 9, 2017 - https://www.programmingmind.com/phaser/topdown-layers-moving-and-collision Past: https://www.programmingmind.com/phaser/fun-with-spells-using-phaser https://www.programmingmind.com/phaser/stop-particles-from-sliding-in-phaser Hope you guys enjoy!
  10. Hi guys. I am currently having a problem trying to disable multitouch function on IPad. I tried using this.game.input.maxPointers = 1; but it doesn't seems to limit number of active pointers as I still able to multitouch. Are there any other way to disable it?
  11. How can i put limits for rotation angle of two objects which connected by "Constraint"? I'm using: game.physics.p2.createRevoluteConstraint(object_A, [0, -20], object_B, [0, 20], maxForce); these object can make rotation 360 degrees - it's not suitable! We should put rotation angle from 0 to 90 degrees. How can we make it?
  12. How to use spriter in phaser/javascript, and how to export it?
  13. Hello I started playing with phaser, some time ago. But now i wanted to try something new, something like Websocket + phaser. And i stuck :/ So, i want to make multiplayer "Game" but i stuck, i cannot happen that game will be still working in background. It should be working that i m logging at 1st tab and sprite is apearing, than i m logging at 2nd tab and on first another sprite is apearing but on different position. So at the end, at the 1st tab will be 3 sprites, or more, depends how many tabs you will open. Sry for my bad engladno :/ I hope you understood something. My code: Client: var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update }); var player; var cursors; function preload() { game.load.image('med1','client/assets/Unit/medievalUnit_01.png'); } function create() { game.stage.disableVisibilityChange = true; game.physics.startSystem(Phaser.Physics.ARCADE); cursors = game.input.keyboard.createCursorKeys(); game.input.mouse.capture = true; ws.send('NewPlayerJoined',nick); player = game.add.sprite(0,0,'med1'); player.nickname = nick; game.physics.enable(player, Phaser.Physics.ARCADE); ws.onmessage = function(data){ game.add.sprite(Math.floor((Math.random() * 100) + 1),Math.floor((Math.random() * 200) + 1),'med1'); console.log("NewPpl"); }; } function update() { if (cursors.left.isDown) { player.body.velocity.x = -100; }else if (cursors.right.isDown) { player.body.velocity.x = 100; }else{ player.body.velocity.x = 0; } if (cursors.up.isDown) { player.body.velocity.y = -100; }else if (cursors.down.isDown) { player.body.velocity.y = +100; }else{ player.body.velocity.y = 0; } } SERVER: const express = require('express'); const http = require('http'); const url = require('url'); const WebSocket = require('ws'); const app = express(); var players = {}; __dirname = 'E:/WebstormProjects/TestWorkingServer'; app.get('/',function(req, res) { res.sendFile(__dirname + '/client/index.html'); }); app.use('/client',express.static(__dirname + '/client')); const server = http.createServer(app); const wss = new WebSocket.Server({ server }); wss.on('connection', function connection(ws) { console.log("New Connection"); ws.on("message",function incoming(data) { ws.send("sumf"); }); }); server.listen(2000, function listening() { console.log('Listening on %d', server.address().port); });
  14. hi developers, i am try to scroll in specific game place using the Phaser Kinetic Scrolling Plugin . but its working with game full width and height how to solve this problem?
  15. I using Phaser-ce 2.7.3 and Cordova 6.4.0 My code import 'pixi' import 'p2' import Phaser from 'phaser' import BootState from './states/Boot' import MenuState from './states/Menu' import GameState from './states/Game' import WinState from './states/Win' class Game extends Phaser.Game { constructor () { const width = window.innerWidth const height = window.innerHeight super(width, height, Phaser.CANVAS, 'content', null) this.state.add('Boot', BootState, false) this.state.add('Menu', MenuState, false) this.state.add('Game', GameState, false) this.state.add('Win', WinState, false) this.state.start('Boot') } } window.game = new Game() Cordova config.xml <?xml version='1.0' encoding='utf-8'?> <widget id="com.example.kids" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>Kids</name> <author email="dev@cordova.apache.org" href="http://cordova.io"> Apache Cordova Team </author> <content src="index.html" /> <preference name="Fullscreen" value="true" /> <platform name="ios"> <allow-intent href="itms:*" /> <allow-intent href="itms-apps:*" /> </platform> </widget> Webpack config var path = require('path') var webpack = require('webpack') // Phaser webpack config var phaserModule = path.join(__dirname, '/node_modules/phaser-ce/') var phaser = path.join(phaserModule, 'build/custom/phaser-split.js') var pixi = path.join(phaserModule, 'build/custom/pixi.js') var p2 = path.join(phaserModule, 'build/custom/p2.js') var definePlugin = new webpack.DefinePlugin({ __DEV__: JSON.stringify(JSON.parse(process.env.BUILD_DEV || 'false')) }) module.exports = { entry: { app: [ 'babel-polyfill', path.resolve(__dirname, 'src/main.js') ], vendor: ['pixi', 'p2', 'phaser', 'webfontloader'] }, output: { path: path.resolve(__dirname, 'dist'), publicPath: './dist/', filename: 'bundle.js' }, plugins: [ definePlugin, new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), new webpack.optimize.UglifyJsPlugin({ drop_console: true, minimize: true, output: { comments: false } }), new webpack.optimize.CommonsChunkPlugin({ name: 'vendor'/* chunkName= */, filename: 'vendor.bundle.js'/* filename= */}), ], module: { rules: [ { test: /\.js$/, use: ['babel-loader'], include: path.join(__dirname, 'src') }, { test: /pixi\.js/, use: ['expose-loader?PIXI'] }, { test: /phaser-split\.js$/, use: ['expose-loader?Phaser'] }, { test: /p2\.js/, use: ['expose-loader?p2'] } ] }, node: { fs: 'empty', net: 'empty', tls: 'empty' }, resolve: { alias: { 'phaser': phaser, 'pixi': pixi, 'p2': p2 } } } And instade of full size screen get black line in buttom
  16. Recently I saw that last year, while I was reading the last Interphase I made a mini game and I didn´t upload it to any place... so I just uploaded to gamejolt and you can give me some feedback The game is basically the one @rich put in Interphase (you should read this if you didn´t) just with a few tweaks and well, me and my gf are the main characters, so it´s pretty cool at least for me Published in Android too, and as usual, waiting for Apple to test/approve it... Gamejolt Android Apple soon...
  17. So I have been messing around with various projects and such and I have created a bunch of nifty features that I think would help a lot of people. Below is a list of things I might plan to strip from my projects as plugins if there was gaining interest in them. Attached are some screenshots of some of the work already done. These plugins will not handle the sprites or in game assets, that is up to you. The first plugin that will be ripped will be the Registry as most of these plugins will be able to work with the Registry, but can do without it. Let me know any thoughts anyone has on these as most are already done I just have to separate them out. Registry: Simple registry to handle the data for a game. Handles both LocalStorage, Cookies and RESTful API. Locale Handler: System for handling multiple locales. Dialog Handler: Dialog system that pulls scripts of dialog based on scripts. Inventory Manager: Complete inventory system that manages multiple inventories. Projectile Weapons: Various types of projectile weapons. Tilemap Generator: Generates a tilemap based on perlin noise. Sprite Generator: Generate sprites via a back end, as well as saving them via the Registry Plugin via Base64 and cache. These are ones that I plan to develop later on after I get the others stripped out. Character Handler: Handles various styles of games: Platformer, Topdown, etc, and various types of entities PC, NPC, Vehicles, etc and provides reusable interactions: directional movement, jumping, attacking, etc. Battle Handler: Turnbase, or Realtime battle system that handles the flow of combat. Save Manager: Handles saving/loading/deleting game states with using the Registry plugin.
  18. Hi, I'm creating a tilemap from a map made in Tiled. When I import it and create a layer in Phaser, the whole layer is created. I'm dealing with a medium-sized map, but I guess on huge maps, this might become costly, performance-wise? Isn't there a way to create a small part of the layer, for example the region around the player, and to create other parts as the player explores the map, in order not to ever create the full map, or only in the rare cases when the player explores it all?
  19. I'm attempting to keep my animated tiles in phaser, but it don't seem to work by default. Does anyone know of a work around? I've included an image of the animated tile map.
  20. Hello :), i am facing an the following issue: How do i preserve my sprites, buttons etc. after switiching back from another state. Example: 1. First State: I have several sprites, which i drag an drop around, draw some lines etc. The moment i click on a certan button State 2 is loaded up Sso when i go back to State 1 from State 2,everything is resetted and my sprites are at the wrong place etc. Question: What can i do about it? greets and thanks
  21. Hi guys, i'm starting with phaser and i'm reading a couple of tutorials. I create an app with one of these tutorials and I'm using Intel XDK to test on my smartphone. I'd like to ask you, what I need to use at the script to recognize the touchscreen to walk. On web I can use the keyboard (up down left right) to walk. If you can link me any tutorial that helps with this, or a link from a question on this forum too, i'll be thanks. Thank you.
  22. Hi, Infinitris - A massively multiplayer online falling block puzzle game, created using Phaser, React, Socket.io and Koa. Here it is: Infinitris.io Controls: Arrow keys and spacebar. Current Features: Classic .io style: Instant join - only specify your nickname and you're ready to play. Ingame chat (Press [Enter]) Grid that expands and collapses based on how many players are in the game. Horizontal wrapping when the grid is larger than the screen. Scoreboard Invalid block placement detection (needs work) Features to add: Spectator mode AFK detection Touch controls Minimap Mobile fullscreen Multiple game rooms Block collections and themes User registration to secure your nickname Facebook: https://www.facebook.com/infinitris Twitter: https://twitter.com/infinitris_io Blog: https://infinitrisblog.wordpress.com/ Please give it a try and let me know what you think! Pyre
  23. hello friends, I have been trying to smoothly fade out certain layers of a tilemap, but have not been successful. I can get the tiles to dissapear, but I cannot get them to fade out. Thankyou for any help
  24. Hello All, I am completely new to Phaser. For learning purposes, I did a little game from a recent book that I bought, and put it on my website, that I use for testing my stuff. Here is the URL: http://www.retroinvaders.net/shump/build/index.html The issue is that the game assets won't load properly at first time, it's only when I refresh the page, at least 4 times, that I see all the assets of the game properly loaded. The Web Console (Firefox) says: Phaser.Cache.getImage: Key "enemyBullet" not found in Cache. Same error for all the game assets is repeated again and again, so not just "enemyBullet", but all the assets. Here is the code of the Preload.js file. export default class Preload { constructor() { this.asset = null; this.ready = false; } preload() { this.load.image('loading_bg', '../assets/images/loading_bg.jpg'); } create() { //background for game this.add.sprite(0,0, "loading_bg"); this.asset = this.add.sprite(this.game.width/2,this.game.height/2, 'preloader'); this.asset.anchor.setTo(0.5, 0.5); this.load.onLoadComplete.addOnce(this.onLoadComplete, this); this.load.setPreloadSprite(this.asset); //do all your loading here //this.load.image('player', '../assets/images/player.png'); //width and height of sprite this.load.image('bg', '../assets/images/bg.jpg'); this.load.image('bullet', '../assets/images/bullet.png'); this.load.image('enemy', '../assets/images/enemy.png'); this.load.image('explosion', '../assets/images/explosion.png'); this.load.spritesheet('player', '../assets/images/gunbot.png', 214, 269); //width and height of sprite this.load.image('hexagon', '../assets/images/hexagon_particle.png'); //this.load.image('bullet', '../assets/images/bullet.png'); this.load.image('enemyBullet', '../assets/images/enemyBullet.png'); //this.load.image('bg', '../assets/images/bg.jpg'); this.load.image('health_bar', '../assets/images/health_bar.png'); this.load.image('health_holder', '../assets/images/health_holder.png'); this.load.image('circle', '../assets/images/circle.png'); //staaaart load this.load.start(); } update() { if(this.ready) { this.game.state.start('game'); } } onLoadComplete() { this.ready = true; } } What am I doing wrong? Aany help, would be greatly appreciated. Thank you.
  25. I'm looking for a fellow programmer/partner to develop an online phaser.io & socket.io game with. I can invest $1000 of my own money into it and split all profit 50/50. Email trap3z@hotmail.com or PM me if you're interested. Thanks.