How do I create a platformer like Cave Story?

0 favourites
  • 7 posts
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • Basically, on the ground, I want to be able to shoot up when up is pressed and left or right when left or right is pressed.

    The more trickier part is that in the air, I want to shoot down as well when down is pressed.

    Has anyone figured out how to do this? I couldn't find any info on this after a deep search.

  • Can't you just do the same you did for left/right and up, but use the "Down" key instead? I don't see why it should be more difficult than the other directions.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • When I shoot up, it would shoot left or right as well, depending on which direction I'm facing.

    The same with shooting down.

    Here's my CAPX: http://dl.dropbox.com/u/64495006/Solar%20Power%20v0.4.capx

  • Give your player a variable that tells which direction he should be shooting based on input and/or direction.

    Player is facing right (not mirrored)? Set variable to 0

    Player is facing left (mirrored)? Set variable to 180

    User is holding up? Set variable to 270

    User is holding down? Set variable to 90

    Then when the player shoots, create the bullet and set its angle to the variable. Of course there's a bit more to it but you get the idea o.o

  • Agh, I don't know why, but whenever my guy comes down on the ground while the variable is set to 90, he still shoots down.

    I tried to fix it, so when he's facing left and comes down to the ground, he shoots left like he's supposed to.

    But when he faces right, he just does nothing.

    Here's my CAPX again; same as before. I think the upper-most event (facing left) took priority, and that's why the facing right event won't work, but if that's the case, how do I set them to the same priority?

  • Added a new group at the bottom with working aiming. Download it HERE

    Also you might want to change the shoot direction variable to an instance variable for your player; there's no reason to make it global!

  • Wow, the shooting works flawlessly.

    Thank you so much!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)