Jump to content

Search the Community

Showing results for tags 'array sprite dynamic'.

  • 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

Found 1 result

  1. Hi I'm building a realtime multiplayer interface using nodejs (socket.io) and jquery. So probably it's an insane question , but I don't need to make a group of sprites but a single sprite for every player in order to keep everyone under control with specific behavior. In my preload I wrote something like this reading from a json file and build on sprite for each player var dynplayer = []; //reading from json file $.each( data, function( index ) { userid=data[index].userid; //use an array for sprite dynplayer[userid] = dcl.add.sprite(90*i, dcl.world.centerY, 'player'); dynplayer[userid].animations.add('front', 0); dynplayer[userid].animations.add('walk_down', [0, 1, 2, 3]); dynplayer[userid].animations.add('walk_up', [12, 13, 14, 15]); dynplayer[userid].animations.add('walk_left', [4, 5, 6, 7]); dynplayer[userid].animations.add('walk_right', [8, 9, 10, 11]); dynplayer[userid].animations.add('server1on', [0,1,2,3,4,5,4,3,2,1,0]); } Everything seems work but when I try to set something inside the update function my code crash becouse I can't recall a sprite used by the array dynplayer[userid] function update() { dynplayer[human_sessionplayer].x=100; -----------------> return undefined (don't consider dynplayer[human_sessionplayer] as a sprite)console.log(dynplayer[human_sessionplayer]); -----------------> return P…r.Sprite {type: 0, physicsType: 0, position: P…r.Point, scale: P…r.Point, pivot: P…r.Point…} } Probably I made a conceptual mistake , I'm a beginner developer on phaser .... but is there some ninja able to show the best way to do this? Thank you for your sharing your time if you answering me back.
×
×
  • Create New...