SkyzohKey Posted February 19, 2015 Share Posted February 19, 2015 Hello ! I worked all the night on my prototype but a bug is still here.Here's the game prototype: http://prototype.blobswar.thanoss.fr/dev.html Look when you fast press UP multiple time, you fly. I want that I the player isn't colliding a groud, or a wall, it can't jump. I tried with the onGround way, but using this way I can't walljump on the walls. :/ Thanks in advance! c: Quote Link to comment Share on other sites More sharing options...
Neso Posted February 21, 2015 Share Posted February 21, 2015 Well, it's just because I had too much free time, I fixed your code for you. Check the differences it will now give you wanted effect. Make an update to your update method.else if (game.keyboard.down('UP')) this.jump(true)else this.moveStop(); this.isColliding = false;And move the following line into the collision group statement. if (other.collisionGroup === 0){ this.isColliding = true;Few afterthoughts no hate here: Your collision groups are messyCode organization provided in examples should probably not be used in every game. You should make your code organization as your game requires it.Make your code cleaner in few weeks you want know what is what and why it is there.Go for a book about good practices in javascript in order to be efficient and better developer and in order to allow others to review your work, and finally you will avoid stupid javascript mistakes and they happen alot.I like the number 5 better then 4 so here's the fifth bullet point. SkyzohKey 1 Quote Link to comment Share on other sites More sharing options...
SkyzohKey Posted February 24, 2015 Author Share Posted February 24, 2015 Oh ! Thanks a lot Neso ! I make this little prototype in order to try panda.js built-in physics, not more ^^.When the current version will be more complete I'll recode all of the game more properly, using scenes and spritesheets.I know that my collision code is... horrible, but for now I don't know how to handle them with a bettre way :3 Thanks again for your help, realy appreciated Quote Link to comment Share on other sites More sharing options...
Neso Posted February 24, 2015 Share Posted February 24, 2015 Well, to be honest haven't played with collision stuff in pandajs yet. But otherwise in order to avoid all those boolean flags I would suggest adding at least one more category for ground. So that you can distinguish between ground and walls. Either way you will probably want to add some more wall specific stuff and this will be real help then. Quote Link to comment Share on other sites More sharing options...
SkyzohKey Posted February 25, 2015 Author Share Posted February 25, 2015 Oh, not a bad idea. I'm searching a way to add World in a game.Container right now (in order to have a background container, a foreground container and a UI container) ^^ Quote Link to comment Share on other sites More sharing options...
Neso Posted February 25, 2015 Share Posted February 25, 2015 Well Pandajs inherited hierarchy of objects form pixijs as far as I know. So instead of adding your objects to the stage add basic containers to the stage and then other objects to the containers. Note though for object to be in update loop you need to add it to the current scene. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.