Home | Rules and Guide | Sign In/Create Account | Write a Post | Reddit | #ludumdare on irc.afternet.org (Info)

Thanks for making Ludum Dare 26 AWESOME! See you in August!

Ludum Dare 26 — April 26-29th, 2013
[ Results: Top 100 Compo, Jam | Top 25 Categories | View My Entry ]
[ View All 2346 Games (Compo Only, Jam Only) | Warmup ]

[ 10 Sec Video Compilation (x3) | 260 Game Video Compilation | IndieCade Deal | Ludum Deals (Unity Deal Ends Soon!) ]


Hooray for keystates!

Posted by (twitter: @AtkinsSJ)
August 30th, 2009 6:15 am

Shows how much of a noob I am really, but I just discovered that SDL lets you check keystates at any time, not just when a keypress event is raised. This makes the movement code much, much simpler. Currently attempting to let you jump, which currently conflicts horribly with the code that stops you falling through the floor… Wait a minute! I think I’ve cracked it! I just need to do a check if the vertical velocity is negative! Yay! :D

Tags:

4 Responses to “Hooray for keystates!”

  1. Jonny D says:

    I mentioned this elsewhere already, but you might get some use out of StickyInput:
    http://code.bluedinosaurs.com/SDL.html

  2. LunarCrisis says:

    If you just check for negative velocity you’ll be able to keep jumping as long as you’re moving upwards XD

    • AtkinsSJ says:

      Yeah, it checks for solid ground before jumping. It’s just that I have a second piece of code which was basically

      If there is no square beneath you, fall
      Else, snap to the ground.

      Which stopped you being able to leave the ground. Using a grid system with a smooth-movement system is complicated. *_*

Leave a Reply

You must be logged in to post a comment.


All posts, images, and comments are owned by their creators.

[cache: storing page]