Jump to content

Search the Community

Showing results for tags 'Problem'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

  1. Hi there! I'm having a problem and maybe someone could help me. In my game I'm trying to load some videos (4 exactly), I did it this way on a separate scene (boot.js) in preload function: this.load.video('beforeWarnVideo', 'src/assets/videos/web_intro.webm', 'canplaythrough', false, false); this.load.video('mainVideo', 'src/assets/videos/into.webm', 'canplaythrough', false, false); this.load.video('menuLoopVideo', 'src/assets/videos/menu_loop.webm', 'canplaythrough', false, false); this.load.video('enterVideo', 'src/assets/videos/enter.webm', 'canplaythrough', false, false); When I test it on any desktop browser it works just fine, but on mobile I can't get videos working. I've connected my iPhone to my mac for debug and I found that Phaser is telling me that the videos aren't fully loaded (I leave an image attached). Is there another way of making sure that my videos are fully loaded before they show? Videos are in webm format. Videos sizes are little bit high, but client want it anyways (I compressed them a lot), sizes are: web_intro -> 291 kb menu_loop -> 7.4 mb into -> 9.9 mb enter -> 3.4 mb Thanks in advance
  2. I have some trouble that I don't know what happen I just want to change the background color of my renderer here var webGLRender = new PIXI.Renderer({ antialias:true, width:300, height:400, backgroundColor:0xf0f0fe}) as you see, the color there is not black, it's some grayish. But when I see the page, it's just black. The screen size is correct, only the color that's not working. I've also tried using option as _backgroundColorRgba and _backgroundColorString but still not working.
  3. hi guys, I am not receiving any notification mails form this forum. I have checked my spam. Is there any way you could check on your side if emails to me bounce or something? (I have just tested the email address I gave the forum, i do receive mails send from other hosts.) Thanks, JP
  4. I am creating a game, where a lot of tiles need to be rendered. My goal is to render with this method at least 500k tiles. Since the tiles won't be redrawn every time but moved, this method should work out. I am using the pixi-tilemap library to create a fast & simple renderer to render a dynamic tilemap. The renderer approves itself to work, but .position.set seems to pull the tilemap from the interface away. I know, the function .position.set does not contain the same parameters as the one of the demo, however this function also does not work with the parameters of the demo. Some parameters must be added. The tutorial I have been using this classic demo: https://github.com/Alan01252/pixi-tilemap-tutorial
  5. Hi, im having a problem with the material of a Ribbon Mesh when im in wireframe mode, it appears in black all. It should be modified because it is changing the color of the mesh with colorKing, heres an example but in my code all mesh is black. In the playground, if you take a look of the sides, it has color. In my example it doesnt Help me out ? https://playground.babylonjs.com/#HHV38I#1
  6. Hi everyone ! I am new to Phaser and i want make my own program for the first time. I start it but i can't understand one error "this.physics.arcade is undefined" After many looks at the doc, it's look like there is no sentance prob. var config = { type: Phaser.AUTO, width: 1366, height: 800, physics:{ default: "arcade", arcade: { debug: false } }, scene: { preload: preload, create: create, update: update, render: render } }; var game = new Phaser.Game(config); /************GLOBAL VAR**********/ var player; //player object player_spd = 150; function preload () { this.load.image("player", "assets/sprites/Player.png") } function create () { //player player = this.physics.add.sprite(1366/2, 800/2, "player"); //controls keys_var = this.input.keyboard.createCursorKeys(); } function update () { //oriente le vaisseau vers la souris player.rotation = this.physics.arcade.angleToPointer("player"); } function render() { this.debug.spriteInfo(player, 32,32); } </script> So i ask you help. ty!
  7. Hi all, I am trying to create a platformer which allows the player to wall jump however I'm struggling to figure it out. I am using the player movement code from the example here: https://phaser.io/examples/v2/games/starstruck. I done some looking around and only found this example which moves the player automatically which I don't want and the code is more suited to that type of mechanic: https://www.emanueleferonato.com/2018/04/28/super-mario-who-html5-platformer-prototype-inspired-by-ios-hit-yeah-bunny-thanks-to-phaser-and-arcade-physics-updated-to-phaser-3-6-0/ Any suggestions on how I could tackle the issue of finding a wall, attaching the player to it and jump to another wall while using the controls of the first example would be appreciated, Thanks
  8. Hey everyone! Currently, I'm building a vertical space shooter game, similar to Galaga, but I'm running into a problem where the enemy respawn function consumes a large amount of processing. Whenever you play my game for roughly 20 - 30 seconds, a noticeable lag begins to drop the framerate from 60fps to as low as 30fps; however, if you play for a little longer after the severe lag begins, the game will jump back up to 60fps. I''ve narrowed it down to this piece of code: createEnemy(): void { var MIN_ENEMY_SPACING = 300; var MAX_ENEMY_SPACING = 3000; var enemy = this.enemies.getFirstExists(false); if (enemy) { enemy.reset(this.game.rnd.integerInRange(0, this.game.width), -20, enemy.health); enemy.body.velocity.x = this.game.rnd.integerInRange(-150, 150); enemy.body.velocity.y = this.game.rnd.integerInRange(50, 100); enemy.body.drag.x = 100; enemy.update = function() { enemy.angle = 0 - this.game.math.radToDeg(Math.atan2(enemy.body.velocity.x, enemy.body.velocity.y)); } } // Send another enemy soon this.game.time.events.add(this.game.rnd.integerInRange(MIN_ENEMY_SPACING, MAX_ENEMY_SPACING), this.createEnemy, this); } If you view the uploaded image attached to this thread, you will notice where the createEnemy() function lies; however, the top functions having the worst Total Time are update, updateRAF, sort, InnerArraySory, Quicksort, etc. All of these functions are influenced by the createEnemy() if you go inside their nested subfolders. Any thoughts on what may be specifically wrong with this code?
  9. Hello people, I have the next problem, I'm making a little game with phaser 3, and I getting a strange behavior with the camera. I have a tiled map, 640x640, and a little sprite of 16px. So I'm trying that the camera focus the player a little closer and follow the player, but.... 1) When I try to zoom the camera to see the player, (passing a integer 2, 3 o 4 to the setZoom method) the camera distances itself more from the sprite, instead of get closer . With setZoom (1): With setZoom (2): 2) If I try to put a slower value, as 0.1, 0.4, the zoom get the camera closer it works, but if I use the startFollow method that makes the camera follow the player, make the screen black (I think it's because focus somewhere else out of the map, but this is an expeted behavior: API Documentation ), if I don't use the startFollow, and update ScrollX, and ScrollY, it do it alright. (I get the effect that i want) but everything is working diferent from the expected behavior: the documentation says that higher values make the camera zoom in, no zoom out, also in this way, I have another problem, a new cam that I use has minimap, do not work if I use a decimal value for the zoom ON THE MAIN camera. I have this config for phaser: var config = { type: Phaser.AUTO, parent: 'phaser-example', width: 640, height: 640, physics: { default: 'arcade', arcade: { debug: false, gravity: { y: 0 } } }, scene: { preload: preload, create: create, update: update } }; At the end of the create method I have : this.cameras.main.setZoom(2); //this.cameras.main.setSize(1000); I try to change the camera size, because if I use a higher zoom, the "square" or size of the camera became smaller. **** I writting this from another machine, but I will update with Screenshoot and more code
  10. Hi! I'm an experienced programmer with C++, but just getting started with JavaScript. I'm making a simple 2D game to get started. I'm using the CreateJS library to do my image/spritesheet manipulation. Right now, I'm trying to create a Sprite class, which will set up a spritesheet in the constructor, and draw the sprite with coordinates in the draw() function. (a member of my Sprite class) Anyways, I'm doing some debugging now. My program stops in the constructor of my Sprite class, and I can't figure out why. To anyone with CreateJS experience, what is wrong with my constructor function?!?!?! Thanks! class Sprite { constructor(src, frameWidth, frameHeight) { window.alert("DEBUG constructor. " + src + ", " + frameWidth + ", " + frameHeight); //Gets here this.spriteSheet = new createjs.SpriteSheet({ images: [queue.getResult(src)], frames: {width: frameWidth, height: frameHeight}, animations: { ani: [0,4] } }); window.alert("DEBUG end constructor"); //Never gets here } draw(x, y) { animation = new createjs.Sprite(this.spriteSheet, "ani"); animation.regX = 99; animation.regY = 58; animation.x = enemyXPos; animation.y = enemyYPos; animation.gotoAndPlay("ani"); stage.addChildAt(animation,1); } }
  11. Hello everyone! I've been a lurker on this site for most of the time and the threads here helped me time and time again to sort things out. I'm currently trying to get a simple Jump'n'Run Game going, but I'm struggling with the collectibles. I'm using a Tiled Object Layer and imported it succesfully into the game. However, the overlap between the objects and the player just isn't working. I've tested the collectPoint1 function on another object and it worked. Also the sprites are all visible in my game. Really, the only problem is the overlap. class Level extends Phaser.Scene { constructor(){ super({ key: 'Level' }); }; create(){ let scene = this; let map = this.make.tilemap({ key: 'Level1'}); let player1_config = {...}; //Player 1 this.player1 = new Player1(this, player1_config); //Setting the score-data this.data.set('player1Score',0); //Animation of the Coins var coinSpin_config = { key: 'spin', frames: this.anims.generateFrameNumbers('coin', { start: 0, end: 7 }), frameRate: 10, repeat: -1 }; this.anims.create(coinSpin_config); //Using createFromObjects to display the coins this.points = map.createFromObjects('HousePoints', 'point', {key: 'coin'}, this); this.points.enableBody = true; this.anims.play('spin', this.points); //Score-text this.scoreText = this.add.text(30, 22, 'Score for ' + this.playerHouse + ': 0'); this.scoreText.setScrollFactor(0); }; //Collecting Points collectPoint1 (player, coin){ var score = this.data.get('player1Score'); this.data.set('player1Score', score + 10); this.scoreText.setText('Score: ' + this.data.get('player1Score')); coin.disableBody(); } update(){ this.player1.move(); this.physics.add.overlap(this.player1, this.points, this.collectPoint1, null, this); } } } As I'm well aware of this post, I've tried it with map.getObjectLayer as well. Didn't work. I'm a huge fan of this template, but its structure is so very different to mine that it down't really help me. . . . . this.housePoints = this.add.group(null); const objects = map.getObjectLayer('HousePoints'); let housePoints_config = { scene: this, collected: false } objects.objects.forEach( (point) => { //Creates a Points Object defined in a Points class (see below) point = new Points(this, housePoints_config); this.housePoints.add(point); }); . . . . . } update(){ this.player1.move(); //This throws the error 'spin is not a function', but that's not my focus this.housePoints.spin(); //This overlap doesn't work either this.physics.add.overlap(this.player1, this.housePoints, this.collectPoint1, null, this); } } ///////////////////////////////////////////// ///This is in another .js file naturally//// /////////////////////////////////////////// class Points extends Phaser.Physics.Arcade.Sprite { constructor(scene, config) { super(config.scene, config.x, config.y); config.scene.physics.world.enable(this); this.scene = config.scene; this.collected = config.collected; this.scene.add.existing(this); this.scene.physics.world.enable(this); var coinSpin_config = { key: 'spin', frames: this.anims.generateFrameNumbers('coin', { start: 0, end: 7 }), frameRate: 10, repeat: -1 }; this.anims.create(coinSpin_config); } spin(){ this.anims.play('spin', true); console.log('point updated'); } } I'd be eternally thankful for every tip! Thanks so much, if you decide to take the time to help me.
  12. Hello all. I am having a browser-specific issue with Phaser 2.10.0 that I cannot seem to understand. I have the following code for a button. minDimension = Math.min(game.width, game.height); resetButton = game.add.sprite(game.width * 0.5, game.height * 0.925, 'Reset'); resetButton.anchor.setTo(0.5, 0.5); resetButton.width = resetButton.height = minDimension * 0.075; resetButton.inputEnabled = true; resetButton.events.onInputDown.add(resetProcess, this); This puts a reset button image at the middle of the bottom of the browser window. As expected, when clicked or tapped, the resetProcess() function is called and the level in my game is reset. This works as expected in most browsers on desktop and mobile; however, in Android Chrome (in my case, Android 7.0.0 and Chrome 64.0.3282.137) the button appears but does not do anything when clicked. I verified that the issue is not in my resetProcess() function. It seems that the onInputDown event isn't working properly. I also tried the following code, using a button instead of an image. minDimension = Math.min(game.width, game.height); resetButton = game.add.button(game.width * 0.5, game.height * 0.925, 'Reset', resetProcess, this); resetButton.anchor.setTo(0.5, 0.5); resetButton.width = resetButton.height = minDimension * 0.075; This caused behavior identical to the snippet above. Previously, a few months ago, I was able to get my button working as expected no matter the browser, and no changes were made to this part of my code since then. Does anyone have any thoughts as to what might be causing this issue, and how to fix it? Thanks.
  13. i need a little help getting my code to work. I can't get the star score to increase. i can only make it go NAN... HELP ? "Making you own game" on the last part i'm having trouble making tht work.
  14. Hello! I'm new to Phaser and HTML5 game development (but not to JS), and have been going through a few free tutorials online. I've already done the mobile toddler's game tutorial, and a simple sidescroller game tutorial, great fun so far! Today I tried to follow an infinite scolling game tutorial (not the same author and not as well written as the first two I followed), but I can't get it to work... The dog falls through the ground on collision with the fleas, and stays stuck down there while the game keeps scrolling. The dog also falls through the ground also after the digging animation... I compared my game.js code to the author's Game.js code, line by line, and didn't see anything missing – I even went so far as to reorder everything the same way she did (the other files were quasi-identical). This is what I found: If I only paste the author's code in place of mine: the game still doesn't work as expected. If I only use the phaser.js v2.1.3 file (from the downloadable source files), instead of the phaser.js v2.6.2 file I use: the game still doesn't work as expected. If I use both the author's Game.js file and phaser.js v2.1.3: the game works! I think that the article must be missing something that can be found in the author's code, because I followed the tutorial exactly. But given that swapping her code for mine still doesn't fix the game, does anyone have any idea what might be causing the player to fall through the ground on collision/overlap? Might it have something to do with gravity, or other physics in Phaser 2.1.3 vs 2.6.2? Thanks in advance!
  15. Hello everyone, I just upgraded my project from Phaser CE to Phaser 3 (latest beta) and I noticed that framerate has dropped down dramatically. I know that version 3 is using custom renderer and not Pixi, but as I understand, the WebGL version should have similar performance as the original Pixi renderer. I have just a single isometric scene with 64x64 tile sprites, every sprite is 80x40 and there are 128 single textures. Before upgrade, I got solid 50-60 FPS, now I can barely move the camera without FPS dropping under 15 FPS. Has anyone actually tested the rendering performance of Phaser 3? Thank you for any hint, Have a nice day, Max.
  16. Greetings! I had an idea for the organization to move the camera when the cursor to a specific side of the screen, for example - have brought the cursor to the top of the screen, the camera moves up. Brought down - the camera moves down. But I do not know how to organize it. There is another problem with importing models from 3ds Max 2015 models do not rotate absolutely nothing, no one axis. Tried already and simple rotation, and rotation directly in 3ds Max. Even tried to change the angle of the file .babylon. Nothing changes. Blender model of spin, but their appearance does not suit me, the model curve. Also wanted to ask. Is it possible for someone to ask for help (direct support), can somebody help me a little bit in the course of writing my project?
  17. So, with some googling i found this... the problem is, it's in TypeScript (I don't know what this is even)... I don't know how to implement this any time i try using this i get unexpected identifiers. (I also noticed this TypeScript language is really similar to c# lol). So how would i use this... I know this is very nooby but meh
  18. Hi everyone!, I've just started to use Phaser's framework, so I don't have enought knowledge about it. I did a game (test it here), it works well on pc's browser. The problem were when I tried to do it mobile friendly. I tried to do that (on boot's state): if (!game.device.desktop) { game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; game.scale.pageAlignHorizontally = true; game.scale.pageAlignVertically = true; game.scale.refresh(); } When I test it in my phone (portrait mode) it works good . The problem is when I rotate the screen (landscape mode), it doesn't scale well(I can't see the bottom). Portrait view: Landscape view: (I can't see the bottom) What is the problem ?? Thanks!!
  19. Can anybody explain me why pointer event (mouse and touch events) does not work in Edge browser ? It Works well with Chrome FireFox Opera! What is difference? Is there any better way to handle (mouse and touch events) in all browser same? You can try and see difference between Edge and Chrome/Fierefox/Opera in this example/game. (here I use hand.min.js) Is there any better alternative of hand.min.js ??? Is there any bug in Edge browser or BabylonJS's hand.js? https://ajna4taiga.tk/PerplexusShadowOpen/PerplexusProd.html Edge problem: When I release any of WSAD key it has longer delay only in Edge (Windows) Browser. Is there any batter way to handle (mouse/touch evnets) with javascript? greetings Ian
  20. Hello! I'm still new working with the framework. So, I got a player that for now dies if collides with another sprite or if it falls out the world (sprite !inworld, so kill it and restart), and when it dies, it displays a message and I put a black picture that I set alpha = .7 behind the text. When the player collides with the sprite everything is OK, but when it falls out the world the dark picture shows it without trasparency! I also tried loading a picture already with transparency edited with photoshop, so I shouldn't set the alpha property in phaser, but same result! Looks like a bug, but idk, I tried some things but ended in same result! here's my Play state: var play = { create: function () { this.cursor = game.input.keyboard.createCursorKeys(); this.jump = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); this.xKey = game.input.keyboard.addKey(Phaser.Keyboard.X); game.world.setBounds(0, -400, 2500, 1000); //Fisicas game.physics.startSystem(Phaser.Physics.ARCADE); game.world.height = 1000; //fondo game.stage.backgroundColor = "#00FFFF"; //capa invisible //this.fondoInv.alpha = 0; //codigo de plataformas this.walls = game.add.group(); this.walls.enableBody = true; game.add.sprite(0, 553, 'plataforma', 0, this.walls); game.add.sprite(300, 400, 'plataforma', 0, this.walls); game.add.sprite(600, 300, 'plataforma', 0, this.walls); game.add.sprite(1000, 300, 'plataforma', 0, this.walls); this.walls.setAll('body.immovable', true); //asi no se caen //plataforma que se cae this.wall2 = game.add.sprite(1800, 300, 'plataforma'); game.physics.arcade.enable(this.wall2); //cosa que mata this.asesino = game.add.sprite(1200, 220, 'asesino'); game.physics.arcade.enable(this.asesino); this.asesino.body.immovable = true; //tipo this.player = game.add.sprite(125, 500, 'tipito'); this.player.anchor.setTo(0.5, 1); game.camera.follow('tipito'); game.physics.arcade.enable(this.player); this.player.body.gravity.y = 800; //this.player.body.collideWorldBounds = true; (PRODUCE BUG CON game.world.setbounds) //animaciones this.player.animations.add('correr', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], true); }, update: function () { //this.walkVelocityR = this.player.body.velocity.x = 200 //this.walkVelocityL = this.player.body.velocity.x = -200 //this.jumpVelocity = this.player.body.velocity.y = -400 game.physics.arcade.collide(this.player, this.walls); game.physics.arcade.collide(this.asesino, this.walls); game.physics.arcade.collide(this.player, this.wall2); game.physics.arcade.overlap(this.player, this.asesino, this.playerDie, null, this) //this.platforms.body.checkCollision.down = false; game.camera.follow(this.player); if (!this.player.inWorld) { this.playerDie(); } //salto mientras camina if ((this.cursor.right.isDown || this.cursor.left.isDown) && this.jump.isDown && this.player.body.wasTouching.down) { this.player.body.velocity.x = 380; this.player.body.velocity.x = -350; this.player.body.velocity.y = -500; //derecha } else if (this.cursor.right.isDown && this.cursor.left.isUp) { //this.cursor.left.enabled = false; this.player.body.velocity.x = 380; this.player.animations.play('correr', 5, true); this.player.scale.x = 1; //izquierda } else if (this.cursor.left.isDown && this.cursor.right.isUp) { //this.cursor.right.enabled = false; this.player.body.velocity.x = -380; this.player.animations.play('correr', 5, true); this.player.scale.x = -1; }else { this.player.body.velocity.x = 0; this.player.animations.stop(); this.player.frame = 4; } //salto if (this.player.body.wasTouching.down) { this.jumps = 1; console.log(this.jumps) } if (this.jumps > 0 && this.jump.justDown){ this.player.body.velocity.y = -500 this.jumps--; console.log(this.jumps); } }, render: function () { //game.debug.inputInfo(32,32); game.debug.key(this.cursor.right, 50, 50) }, playerDie: function () { this.player.kill(); this.fondoInv = game.add.sprite(game.camera.x, game.camera.y,'fondoInv'); this.fondoInv.alpha = .77; var perdiste = game.add.text(game.camera.x + (game.width/2), game.camera.y + (game.height/2), "You have lost", {font: "65px Arial", fill: "#ff0044", align: "center"}); perdiste.anchor.set(0.5,0.5); perdiste.fixedtoCamera = true; game.time.events.add(4000, this.start, this) }, start: function () { game.state.start('play'); } } Thanks for helping!
  21. Downloading MelonJS (mini) throws up error 800A0404. The case is similair with other versions. I've looked everywhere for a solution but can't find one! am i the first person to have this issue? How do i solve it? please?
  22. Hey guys, I have made some scaling of the game via CSS so I can have my game always the proper size in the browser window. However, I lose my onInputDown because for some reason the game container overflows but visually is okay.... here is my CSS styling (visually it looks perfect): html { height: 100%; margin: 0; padding: 0; } body { height: 100%; margin: 0; padding: 0; } #content { height: 100%; } #content > canvas { margin: 0 auto; height: auto !important; width: auto !important; max-height: 100%; max-width: 100%; position: relative; top: 50%; transform: translateY(-50%); } Here is my game init class: import Boot from 'states/Boot'; import Preload from 'states/Preload'; import GameState from 'states/GameState'; import * as Constants from 'data/Constants.js' class Game extends Phaser.Game { constructor() { let height = window.screen.height; let width = window.screen.height / Constants.SIXTEEN_TO_NINE; super(width, height, Phaser.AUTO, 'content', null); this.state.add('Boot', Boot, false); this.state.add('Boot', Preload, false); this.state.add('GameState', GameState, false); this.state.start('Boot'); }; } new Game(); If I don't have any css code - the input works. I believe it is because the game is still bigger than what it visually appears. Has anyone had this issue?
  23. https://www.dropbox.com/s/l2l67aququd7she/Patch.babylon?dl=0 or https://ajna4taiga.no-ip.org/BabylonBall/Patch.babylon Hire is playground which doesn't work ok any more http://www.babylonjs-playground.com/#CKEHJ#1 or http://www.babylonjs-playground.com/#CKEHJ#3 How can I load my .babylon file from dropbox or my server? This code has worked. What is goging on now? I see with F12 new problem XMLHttpRequest cannot load https://ajna4taiga.no-ip.org/BabylonBall/Patch.babylon. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.babylonjs-playground.com' is therefore not allowed access. But this things has worked before. How can I make this example to work again? Any alternatives? (I also try like this http://www.babylonjs-playground.com/#YEKUO#1 set data (copy/paste from .babylon file) but here is problem with string of data ! I try \" and \' also but no luck.) I would like to make some playground to ask something and I can't meke playground to load .bayblon file. Greetings Ian
  24. I need help. I was following a tutorial online for the Phaser States, and I did everything right (I think), but obviously, I've made some changes myself to fit to what I kind of want. Here is the code: var loadState = { preload: function() { // Load the BG Images (Before so we can have an awesome looking loading screen) game.load.image('redPlanet', '././assets/images/redplanet.png'); game.load.image('spaceBG', '././assets/images/spaceBG.png'); // Preload the one character we need to look awesome! game.load.image('scavenger', '././assets/images/Scavenger.png'); // Add the loading label and the character, so the player doesn't think the game crashed. var background = game.add.sprite(0, 0, 'spaceBG'); background.scale.setTo(0.6); var character = game.add.sprite(80, 150, 'scavenger'); var loadingLabel = game.add.text(0, 0, 'Loading...', {font: '30px Courier', fill: '#fff'}); loadingLabel.alignTo(character, Phaser.RIGHT_CENTER, 16); // Load the Planet Images game.load.image('planet1', '././assets/images/Planet1.png'); game.load.image('planet2', '././assets/images/Planet2.png'); game.load.image('planet3', '././assets/images/Planet3.png'); game.load.image('planet4', '././assets/images/Planet4.png'); game.load.image('planet5', '././assets/images/Planet5.png'); game.load.image('planet6', '././assets/images/Planet6.png'); game.load.image('planet7', '././assets/images/Planet7.png'); game.load.image('planet8', '././assets/images/Planet8.png'); game.load.image('planet9', '././assets/images/Planet9.png'); game.load.image('planet10', '././assets/images/Planet10.png'); game.load.image('planet11', '././assets/images/Planet11.png'); game.load.image('planet12', '././assets/images/Planet12.png'); game.load.image('planet13', '././assets/images/Planet13.png'); game.load.image('planet14', '././assets/images/Planet14.png'); // Load the pause button game.load.image('pauseButton', '././assets/images/pauseButton.png'); } create: function() { game.state.start('menu'); } } And that is not all. Every single one of my state files has an error that says: Expected '}' to match '{' from line 1 and instead saw 'create'. Missing Semi-Colon. Unrecoverable Syntax Error (93% Scanned) Please help me, as this was going to be the way I made my game because I really like how organized states are!
  25. 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); });
×
×
  • Create New...