Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: If keyboard isn't pressed  (Read 3944 times)

0 Members and 1 Guest are viewing this topic.

ruben98

  • Newbie
  • *
  • Posts: 4
    • View Profile
If keyboard isn't pressed
« on: June 09, 2013, 08:52:06 pm »
Hello,

I wanne make a game, and when there isn't a key pressed I wanne let the character face forward.
How do I do that.

Thanks  :)

The Hatchet

  • Full Member
  • ***
  • Posts: 135
    • View Profile
    • Email
Re: If keyboard isn't pressed
« Reply #1 on: June 09, 2013, 08:58:40 pm »
You could make 'forward' the default facing direction, then whenever a Key is released set direction to forward.  Just one idea.

ruben98

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: If keyboard isn't pressed
« Reply #2 on: June 09, 2013, 09:25:44 pm »
Hmmm that's smart but how do I do that?

The Hatchet

  • Full Member
  • ***
  • Posts: 135
    • View Profile
    • Email
Re: If keyboard isn't pressed
« Reply #3 on: June 10, 2013, 07:47:08 am »
There's a KeyReleased event I believe, and how you iterate your Direction is up to you.  I just use an int 0-3 to show what way i'm going.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: If keyboard isn't pressed
« Reply #4 on: June 10, 2013, 11:11:56 am »
I wanne make a game, and when there isn't a key pressed I wanne let the character face forward.
How do I do that.
Have you already read the SFML tutorials? Because it seems like you haven't worked with SFML at all. If you read them, it should become obvious how to solve this problem ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: