Yes, it is very simple. I have made an example project for you to take a look at. I'll explain how to do it, if you want to follow along and I also uploaded the project so you can play with it.
1) First, create a new project in Godot.
2) Click on "2D Scene" as the root node from the pop-up menu.
3) Click Node2D and then press the "+" icon on the upper left. This will add a new child Node. You can also right click the Node2D and select "+ Add Child Node".
3) In the pop-up that appears, start typing "ColorRect". You should see a green icon that says "ColorRect" in the middle. You can double-click it, or you can select it and press the "Create" button on the bottom right.
4) You'll see a small white box now in the editor viewport. Click it, then on the Inspector on the right, click "Rect" and set Size x to 1024 and Size y to 600 (the default window resolution). You can also click the white color on the Inspector and make this black.
5) Click Node2D on the left Scene panel, then add a new script by pressing the button above with the paper and green plus icon. You can also right-click Node2D and click "Attach Script".
6) In the script pop-up window you can leave the defaults and press "Create".
7) Select all the code in the window and press back-space to delete it. Then paste in the following:
# script inherits from Node2D, which is a good root node for a 2D project
extends Node2D
# variable stores the mouse y position on press to calculate swipe distance
var last_y = 0;
# _input(event) is a built-in function which fires every time some input happens
func _input(event):
# the event "right_click" was custom made in the project settings input tab
# when the user presses down the right mouse button this event fires
if event.is_action_pressed("right_click"):
# save the mouse down y position
last_y = event.position.y
# same as above, but fires when the mouse is released
elif event.is_action_released("right_click"):
# find the difference in y values to see if user swiped up or down
var moved = event.position.y - last_y
# more than 100 pixels up, so user swiped up
if moved < -100:
# change the full screen color rectangle to white
get_node("ColorRect").color = Color(1.0, 1.0, 1.0)
# more than 100 pixels down, so user swiped down
elif moved > 100:
# change the full screen color rectangle to black
get_node("ColorRect").color = Color(0.0, 0.0, 0.0)
8) Finally, set the input event for right-clicking in the project settings. Click "Project" on the top menu bar, then "Project Settings". Click the tab named "Input Map". On the top text box next to "'Action:" type in "right_click" (without quotes). Then scroll down to the bottom and next to "right_click" press the "+" icon. Choose "Mouse Button". In the pop-up window choose "Right Button" under the "Mouse Button Index:" Click "Change" and then click "Close" to close the window.
9) Press the Play (>) icon on the top right. It may ask you to save the scene. Just click "Okay".
10) You will see a black window. Swipe up or down with the right mouse to see the color change.
It may seem like a lot of steps, but I was trying to explain everything as clear as possible. Once you start working in Godot, you'll see things are very quick and easy to do, just spend some time learning. Cheers.