Right now I'm just getting the hang of Godot, but I'm having issues with Input and it could be something silly. <br /><br />I have a main script which all that does is just set Fullscreen On or Off, same with maximizing the Window and setting the Game Title. I also have a Playermovement script which right now all it does is set the players direction variable.<br /><br />When I run the game it'll act normal unless I click the game window "but not the title"<br />Invalid get index 'scancode' (on base: 'InputEvent').<br /><br />However, if I remove the if statement checking if I pressed down and just replace it with pass then the program will run fine.<br /><br />Here's both scripts.<br /><br />Main<br />
extends Area2D<br /><br /># Godot Basic Main Game Script<br /><br />func
ready():<br /> # Called every time the node is added to the scene.<br /> # Initialization here<br /> OS.set_window_title(&quot;Just some awesome game&quot;) # Set the Game Title<br /> OS.set_window_fullscreen(false) # Set Fullscreen<br /> set_process_input(true) # Start the Script Loop<br /> pass<br /><br /><br />#Input handler, listen for ESC to exit app<br />func input(event):<br /> if(event.is_pressed()):<br /> if(event.scancode == KEY_ESCAPE): # Quit Game, Should not be used in Final Release! Should be a menu option!<br /> get_tree().quit()<br /> elif(event.scancode == KEY_F10): # Maximize the Game Window<br /> OS.set_window_maximized(true)<br /> elif(event.scancode == KEY_F9): # Revert to the Original Game Window<br /> OS.set_window_maximized(false)<br /> elif(event.scancode == KEY_F12): # Toggle Fullscreen<br /> OS.set_window_fullscreen(true)<br /> elif(event.scancode == KEY_F11): # Exit Fullscreen<br /> OS.set_window_fullscreen(false)
<br /><br />Edit: I simply used actions to check if the keys were pressed which solved my problem, but would still like to know why I was getting errors when using scancode. <br />