SFML community forums

Help => Window => Topic started by: expedo on June 04, 2019, 03:27:10 am

Title: Event::KeyPressed not working now?
Post by: expedo on June 04, 2019, 03:27:10 am
Im doing this simple project where you can control and make the character jump, but whenever I do if (event.type == Event::KeyPressed) it wont execute the code in it when I press a key. Though this worked fine a while ago for some reason and my unfinished code is this:
(click to show/hide)
Title: Re: Event::KeyPressed not working now?
Post by: FRex on June 04, 2019, 06:39:39 am
         if (event.type = Event::Closed)

This line is an assignment, not a comparison, and Event::Closed is (usually?) 0 so it'll not close the Window and it prevents handling any other event type because event.type is always Event::Closed.
Title: Re: Event::KeyPressed not working now?
Post by: expedo on June 04, 2019, 01:24:25 pm
thanks