rudyardcatling Posted April 27, 2019 Share Posted April 27, 2019 as an example : this youtube video leaving out the details : im using Quote physics.moveTo(this.sprite, this.sprite.x -64, this.sprite.y, 64, 500) and so on depending on left/right/up/down arrow keys, but what i need for my particular situation is an absolute moveTo , this works fine but it just sets the sprite on a "path towards" after which it keeps moving. Now i can catch all of it in the update() section of the scene and even if perfect == doesnt seem to work (cf. shown in vid) so its >= or <= due to the fact that its several digits below the dot and the exact number doesnt hit as it updates slower than the numbers do I can use a lot of conditional structure to make it stop, and then set the absolute .x and .y to the nearest "snap" and it will be fast enough to not show but, im fairly new to all of it and its a pretty big environment so i was wondering if i might be missing a built-in command / method somewhere that does exactly just that (i seen a plugin but as id be able to write the code for it myself thats not necessary, the only thing to improve would be an exact moveTo command) in the end the game has to be turnbased (it uses ajax requests and sends only the input to the server, the intention being the game"state" or map"state" being kept serverside first to prevent all and any kind of meddling or messing as, even if someone were to alter any data it would not corellate with what's on the server and an error could be thrown Far from that though, so instead of 500 googles i'll just try to ask it here i had another little question, which is probably not very important in 2019 but : i have a sprite that's rendered in blender at 256x256 px, but for this piece i used sprite.setDisplaySize(64,64) as that is the "tile size" used , again something that wont show to the naked eye unless in very large projects but thats just curiosity : assuming a device has plenty of working memory if you're talking kilobyte sized assets does it impact performance in any way ? e.g. how does Phaser treat this ? does it make a copy of the sprite at 64x64px and uses that from memory OR does it resize the actual sprite every cycle (which means somewhere extra cpu will be used) thats just curiosity but might come in handy later when i grow up ? if anyone knows, thanks in advance Link to comment Share on other sites More sharing options...
Recommended Posts