danmoople

Members
  • Content Count

    6
  • Joined

  • Last visited

About danmoople

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. danmoople

    Any books or tutorials about phaser + socket.io ??

    Yeah I have but it uses "Eureca.io" but not Socket.io
  2. Hello everybody! I can create single player games with phaser and now I want to start making multiplayer games using socket.io + node.js So unfortunately I haven't found any tutorials about how to create games on phaser with phaser. I have never had projects with serverpart(so I have no experience in it) So that's all I could understand and write myself :[ SERVER PART var express = require('express'); var app = express(); var serv = require('http').Server(app); var counter = 0; app.get('/', function(req, res) { res.sendFile(__dirname + '/client/index.html'); }); app.use('/client', express.static('/client')); serv.listen(2000); console.log('server started'); var io = require('socket.io')(serv); io.sockets.on('connection', function(socket) { counter++; console.log('connection #' + counter); }); Client <script> var socket = io(); var sendInfo = function() { socket.emit('objAppear'); } </script> <button id="btn" onclick="sendInfo();">Appear</button> Of course that's the simplest thing to create using node + socket.io So now I want to create multiplayer in games I've already created. But how?!?! I can't find any tutorials. Can you please help me. Server part is too hard for me
  3. danmoople

    Why overlap isn't working?

    OMG finally I figured out what's wrong!! var playState = { create: function() { game.physics.startSystem(Phaser.Physics.ARCADE); game.world.setBounds(0,0,1600,1600); this.bg = game.add.sprite(0,0,'bg'); this.cell = game.add.sprite(200,200,'cell'); game.physics.arcade.enable(this.cell); game.camera.follow(this.cell); this.cursor = game.input.keyboard.createCursorKeys(); this.cell.scale.setTo(0.4,0.4); food = game.add.group(); food.enableBody = true; food.physicsBodyType = Phaser.Physics.ARCADE; for(var i = 0; i < 200; i++) { foodcells = food.create(Math.random()*game.world.width, Math.random()*game.world.height, 'cell'); } food.setAll('scale.x', 0.1); food.setAll('scale.y', 0.1); }, update: function() { game.physics.arcade.overlap(this.cell, food, this.eatFood, null, this); this.cell.body.collideWorldBounds = true; if(this.cursor.left.isDown) { this.cell.x -= 10; } if(this.cursor.right.isDown) { this.cell.x += 10; } if(this.cursor.up.isDown) { this.cell.y -= 10; } if(this.cursor.down.isDown) { this.cell.y += 10; } }, eatFood: function(cell, f) { f.kill(); } }
  4. danmoople

    Why overlap isn't working?

    Thanks for advice. That's what I wrote. But it still doesn't work. Sorry but I'm beginner in phaser. Can you help me what's wrong? var playState = { create: function() { game.physics.startSystem(Phaser.Physics.ARCADE); game.world.setBounds(0,0,1600,1600); this.bg = game.add.sprite(0,0,'bg'); this.cell = game.add.sprite(200,200,'cell'); game.physics.arcade.enable(this.cell); game.camera.follow(this.cell); this.cursor = game.input.keyboard.createCursorKeys(); this.cell.scale.setTo(0.4,0.4); food = game.add.group(); for(var i = 0; i < 200; i++) { foodcells = food.create(Math.random()*game.world.width, Math.random()*game.world.height, 'cell'); } food.setAll('scale.x', 0.1); food.setAll('scale.y', 0.1); food.enableBody = true; }, update: function() { this.cell.body.collideWorldBounds = true; if(this.cursor.left.isDown) { this.cell.x -= 10; } if(this.cursor.right.isDown) { this.cell.x += 10; } if(this.cursor.up.isDown) { this.cell.y -= 10; } if(this.cursor.down.isDown) { this.cell.y += 10; } /* OVERLAP FUNC THAT DOESN'T WORK */ game.physics.arcade.overlap(this.cell, foodcells, this.eatFood, null, this); }, eatFood: function() { foodcells.kill(); } }
  5. danmoople

    Why overlap isn't working?

    Hello everybody! I want to create agar io clone on phaser. So I already created a little scene. I wrote a code for 'eating food'. But unfortunately overlap doesn't work. So when I hit food it should dissapear. But it doesn't. What's wrong?? My code: var playState = { create: function() { game.physics.startSystem(Phaser.Physics.ARCADE); game.world.setBounds(0,0,1600,1600); this.bg = game.add.sprite(0,0,'bg'); this.cell = game.add.sprite(200,200,'cell'); game.camera.follow(this.cell); this.cursor = game.input.keyboard.createCursorKeys(); this.cell.scale.setTo(0.4,0.4); for(var i = 0; i < 200; i++) { this.food = game.add.sprite(Math.random()*game.world.width, Math.random()*game.world.height, 'cell'); this.food.scale.setTo(0.1,0.1); game.physics.arcade.enable(this.food); } }, update: function() { /* MOVEMENT */ if(this.cursor.left.isDown) { this.cell.x -= 20; } if(this.cursor.right.isDown) { this.cell.x += 20; } if(this.cursor.up.isDown) { this.cell.y -= 20; } if(this.cursor.down.isDown) { this.cell.y += 20; } /* OVERLAP FUNC THAT DOESN'T WORK */ game.physics.arcade.overlap(this.cell, this.food, this.eatFood, null, this); }, eatFood: function() { this.food.kill(); } } So please help me! This bug makes me crazy :{
  6. danmoople

    Why aren't my walls solid?

    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); }, ...