JokerJESUS

Members
  • Content count

    19
  • Joined

  • Last visited

About JokerJESUS

  • Rank
    Member

Recent Profile Visitors

332 profile views
  1. Good graphics/pixel editor for sprites

    I like this one http://pyxeledit.com/
  2. Phaser Text Editor/IDE autocomplete API

    Ok, i bought it. but can you tell me if there is some Phaser Themplate for it or i just have to add /// <reference path="lib/phaser.js"/>
  3. Phaser Text Editor/IDE autocomplete API

    Hello, i m looking for some text editor or ide with autocomplete working with phaser. I was trying do smf with sublime text 3 (love this editor) but couldn't make it. Also i was trying with VS15 but Phaser Themplate is out dated
  4. The Phaser 3 Wishlist Thread :)

    Please, do Isometric view, with correct inputs and good collisions system. Really miss that
  5. Multiplayer game with SOCKET.io, how to add players?

    Thank you, with socket.broadcast.emit() i can use less code.
  6. Multiplayer game with SOCKET.io, how to add players?

    Hey, thank you. Thats pretty good idea. But tell me, has io.socket.broadcast its own loop? or i have to send it by phaser : update? And i have all of other players in group Players, only client player is in one variable like var player = game.add.sprite
  7. Multiplayer game with SOCKET.io, how to add players?

    So this is my function for adding players if new player joined var Players = game.add.physicGroup(); is a group created in main script JESUS.prototype.SyncPlayers = function(data){ data = JSON.parse(data); PlayersData = data; jQuery.each(PlayersData, function(index, value) { if(index !== player.nickname){ if(!Players.getByName(index)){ Players.create(game.world.randomX, game.world.randomY, 'med1', 0, true, 0).name = index; Players.getByName(index).anchor.x = 0.5; Players.getByName(index).anchor.y = 0.5; Players.getByName(index).health = 100; } Players.getByName(index).x = PlayersData[index].x; Players.getByName(index).y = PlayersData[index].y; } }); } io.on("newPlayer",function(data){ JESUS.SyncPlayers(data); }) And on server io.sockets.on('connection', function(socket){ console.log('socket connection'); socket.on('NewPlayerJoined',function(data){ console.log(data); // in data, i m sending Nickname of a players and putting it in playersData = {} PlayersData[data] = {x:0,y:0}; io.sockets.emit("newPlayer",data); console.log("newPlayerjoined"); }); This is a testing code. But i hope you will get it
  8. phaser Group custom properties

    Hello, I have a problem with adding custom properies to Phaser Groups So i tried like this Gun1.enableBody = true; Gun1.createMultiple(10,'bullet'); Gun1.addAll('dmg', 20); And like this Gun1.enableBody = true; Gun1.createMultiple(10,'bullet'); Gun1.setAll('dmg', 20); And none of childrens has prop dmg....
  9. Phaser + Websocket not working while browser is unfocussed

    So, how people are doing their multiplayer projects? like this Tutorial demo : Creating a basic multiplayer game He is focussing right browser, but left is still working
  10. 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); });
  11. Motion Path on Graphics

    Hello, i made tileset, and did pathfinder for it. But now how can i do that sprites, or groups of sprites will move on this path. my code for path: I used graphics -> lineTo for making path. function pathfinder(array){ var x = groupDisable.children[0].x; var y = groupDisable.children[0].y; graph = game.add.graphics(); graph.lineStyle(1, 0xffd900, 1); graph.moveTo(x,y); for(var i = 0; i < groupDisable.length; i++){ groupDisable.forEach(function(arg){ if(x + 32 == arg.x && y == arg.y && !arg.checked){ console.log('->'); x = arg.x; y = arg.y; arg.checked = 1; graph.lineTo(x, y); }else if(x == arg.x && y + 32 == arg.y && !arg.checked){ console.log('\\/'); x = arg.x; y = arg.y; arg.checked = 1; graph.lineTo(x, y); console.log('argX: '+arg.x+' argY: '+arg.y+' x: '+x+' y: '+y); }else if(x - 32 == arg.x && y == arg.y && !arg.checked){ console.log('<-'); x = arg.x; y = arg.y; arg.checked = 1; graph.lineTo(x, y); }else if(x == arg.x && y - 32 == arg.y && !arg.checked){ console.log('/\\'); x = arg.x; y = arg.y; arg.checked = 1; graph.lineTo(x, y); } });
  12. Arcade collisions Problem

    @up so id did this if (A.isDown) { player.body.velocity.x = 150; } if (D.isDown) { player.body.velocity.y = -150; } if (W.isDown) { player.body.velocity.x = 150; } if (S.isDown) { player.body.velocity.y = -150; }But now my player is not moving at all.
  13. Arcade collisions Problem

    function update() { game.physics.arcade.collide(bullets, boxGroup,function(bullet){ bullet.kill(); }); game.physics.arcade.collide(bullets, player); game.physics.arcade.collide(player, boxGroup); game.physics.arcade.collide(player, box1,function(){ player.kill(); }); ammo.text = 'AMMO:'+reload+'/25'; //Movement!!! player.rotation = game.physics.arcade.angleToPointer(player); if (A.isDown) { player.x --; } if (D.isDown) { player.x ++; } if (W.isDown) { player.y --; } if (S.isDown) { player.y ++; } if(R.isDown){ if(pre_reload == 0) { pre_reload = 1; reload = 0; AUTOreload(); } } else { player.animations.stop(); player.body.velocity.y = 0; player.body.velocity.x = 0; } //END of Movement ... //Shooting AND Reloading!!! bullet = bullets.getFirstExists(false); if (reload > 0) { if (bullet) { if (game.input.mousePointer.isDown) { fire(); } } }else if(reload < 1 && pre_reload == 0){ AUTOreload(); pre_reload = 1; } //END of Shooting ... //COLLISIONS !!! /*game.physics.arcade.collide(bullets, boxGroup,function(bullet){ bullet.kill(); }); game.physics.arcade.collide(bullets, player); game.physics.arcade.collide(player, boxGroup); game.physics.arcade.collide(player, box1,function(){ player.kill(); });*/ //END OF COLLISIONS!!!}Still nothing. ;/
  14. Arcade collisions Problem

    Hello, i have a problem with collisions, betwen player and box (betwen box and bullets works fine!!). R to reload. thats how it looks, and sorry for mess in code, but i m changing everything all time. thats my "game". I m just testing and learning. jokerjesus.pl <--- app.html it's a game. thats my code: <spoiler> var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'jesus', { preload: preload , create: create , update: update, render: render });var bullets, bullet, cursors, fireButton, player, ammo, R, W, S, A, D, boxGroup, box, box1;var bulletTime = 0;var reload = 25;var pre_reload = 0;function preload(){ game.load.image('bullet', 'img/bullet.png'); game.load.image('players', 'img/players.png', 16, 32); game.load.image('box', 'img/box.png', 32, 32);}function create(){ //PLUGINS!!! game.add.plugin(Phaser.Plugin.Debug); //END of Plugins!!! ammo = game.add.text(10, 10, 'AMMO:' + reload, { font: '12px Arial', fill: '#fff' }); player = game.add.sprite(30,30,'players'); game.physics.enable(player); game.camera.follow(player); player.anchor.set(0.5); player.checkWorldBounds = true; player.enableBody = true; createBullets(); createBoxes(); cursors = game.input.keyboard.createCursorKeys(); fireButton = game.input.keyboard.addKey(Phaser.Keyboard.leftMouse); R = game.input.keyboard.addKey(Phaser.Keyboard.R); W = game.input.keyboard.addKey(Phaser.Keyboard.W); S = game.input.keyboard.addKey(Phaser.Keyboard.S); A = game.input.keyboard.addKey(Phaser.Keyboard.A); D = game.input.keyboard.addKey(Phaser.Keyboard.D);}function update() { ammo.text = 'AMMO:'+reload+'/25'; //Movement!!! player.rotation = game.physics.arcade.angleToPointer(player); if (A.isDown) { player.x --; } if (D.isDown) { player.x ++; } if (W.isDown) { player.y --; } if (S.isDown) { player.y ++; } if(R.isDown){ if(pre_reload == 0) { pre_reload = 1; reload = 0; AUTOreload(); } } else { player.animations.stop(); player.body.velocity.y = 0; player.body.velocity.x = 0; } //END of Movement ... //Shooting AND Reloading!!! bullet = bullets.getFirstExists(false); if (reload > 0) { if (bullet) { if (game.input.mousePointer.isDown) { fire(); } } }else if(reload < 1 && pre_reload == 0){ AUTOreload(); pre_reload = 1; } //END of Shooting ... //COLLISIONS !!! game.physics.arcade.collide(bullets, boxGroup,function(bullet){ bullet.kill(); }); game.physics.arcade.collide(bullets, player); game.physics.arcade.collide(player, boxGroup); game.physics.arcade.collide(player, box1,function(){ player.kill(); }); //END OF COLLISIONS!!!}function render() { //game.debug.geom( rect, 'rgba(255,0,0,1)' ) ; game.debug.spriteBounds(box1); game.debug.body(player);}function AUTOreload(){ setTimeout(function(){ reload = 25; pre_reload = 0; },3000);}function createBullets(){ bullets = game.add.group(); bullets.enableBody = true; bullets.physicsBodyType = Phaser.Physics.ARCADE; bullets.createMultiple(30, 'bullet'); bullets.setAll('anchor.x', 0.5); bullets.setAll('anchor.y', 0.5); bullets.setAll('outOfBoundsKill', true); bullets.setAll('checkWorldBounds', true);}function createBoxes(){ boxGroup = game.add.group(); boxGroup.physicsBodyType = Phaser.Physics.ARCADE; boxGroup.enableBody = true; boxGroup.setAll('anchor.x', 0.5); boxGroup.setAll('anchor.y', 0.5); box1 = game.add.sprite(100,100,'box',0,boxGroup); box1.body.immovable = true;}function fire(){ if (game.time.now > bulletTime) { reload -= 1; bullet.reset(player.x, player.y); //bullet.body.velocity.setTo(game.input.x, game.input.y); bullet.body.speed = 100; bullet.rotation = game.physics.arcade.moveToPointer(bullet, 1200, game.input.activePointer, 0); //bullet.rotation = game.physics.arcade.moveToXY(bullet, game.input.x, game.input.y, 600, 600);//(, 1000, game.input.activePointer, 400); bulletTime = game.time.now + 200; console.log(reload); }}</spoiler>
  15. Phaser Shooting.

    Thanks, i got it. In maxTime i set 0;