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

Author Topic: Event::KeyPressed not working now?  (Read 224 times)

0 Members and 1 Guest are viewing this topic.

expedo

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Event::KeyPressed not working now?
« 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)

FRex

  • Hero Member
  • *****
  • Posts: 1842
    • View Profile
    • My GitHub Page
    • Email
Re: Event::KeyPressed not working now?
« Reply #1 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.
ZipSavings, script to count rar/7z/zip savings: https://goo.gl/vvBj5M
LuaConsole: https://goo.gl/X4kRUk
FoxRaycaster: https://goo.gl/27nVS8
Small Games - Heart, Routing and Snek: https://goo.gl/15ZGWE https://goo.gl/k5gwWD https://goo.gl/4nKPnT
Botes - a notes app in Pascal: https://goo.gl/bzTqsi

expedo

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Event::KeyPressed not working now?
« Reply #2 on: June 04, 2019, 01:24:25 pm »
thanks