Sign in to follow this  
SkyzohKey

[WIP] BlobsWar : a little bug that I have to correct

Recommended Posts

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:

Share this post


Link to post
Share on other sites

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 messy
  • Code 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.

Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.