gdo Flashcards

1
Q

A Prefab in unity is called a

A

Scene in godot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The usual components of a player are

A

Animated Sprite, body, collider

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

res:// refers to

A

the base directory of the project

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

To get a component in a script, instead of using get_node you can also use

A

$NodeName

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

To create a scene

A

right click on the node and choose save node as scene

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The root node is essentially a

A

viewport

Note: To change the viewports values go to
project -> project settings -> display -> window

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

To add resources to your file system

A

right click in file system -> show in file manager

and drag the resources into that folder that pops up

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A sprite node automatically inherits all the

A

functionality of a Node2D

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

To give a sprite an image you must drag the image

A

into its texture field

Note: An image with multiple images together that form an animation uses the “Atlas Texture”

Note: If you want an animation, this needs to be an animated sprite

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In godot the pivot point field is called the

A

offset

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

To add a new script to a node

A

right click -> attach script

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

To get the x and y lengths of the viewport, type

A

get_viewport().size.x

get_viewport.seize.y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

To change the main scene (scene that renders when you press play)

A

Project -> Project Settings -> Application -> Run -> Main Scene

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

To set the position of using a vector, type

A

Vector2(x, y)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

To rotate a node from a script, type

A

rotate(deg2rad(90))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The value of multiplying speeds by delta in the _process function is

A

that it will normalize the speed across different machines

17
Q

To translate a node from the script, type

A

translate(Vector2(x, y))

18
Q

To add a node to a node from a script, type

A

add_child()

19
Q

To create an animated sprite

A

Add AnimatedSprite node
Set frames field to sprite frames
Add images to the sprite frames
Set animation field to the same name of the animation you used in the sprite frames

20
Q

To get the mouse position, type

A

get_viewpost().get_mouse_position()

21
Q

To run code if a click is happening, type

A
func _process(delta):
    if Input.is_mouse_button_pressed(BUTTON_LEFT):
        pass
22
Q

To set and check the type of a node, type

A

my_node.set_meta(‘type’, ‘wall’)

my_node.get_meta(‘type’)

23
Q

To access a variable from a different script, type

A

get_node(“../nodePath”).variable

24
Q

To make a kinematicbody2d chase, type

A

const SPEED = 500

func _process(delta):
    var vec = target_position - self.position # getting the vector from self to the mouse
	move_and_collide(vec.normalized() * delta * speed)
25
Q

You can edit the default physics in

A

project -> project settings -> physics -> 2d

26
Q

To create a player, the structure of notes you want are

A

RigidBody2D
Sprite
CollisionShape

27
Q

To create a building, the structure of notes you want are

A

StaticBody2D
Sprite
CollisionShape

28
Q

An impulse is

A

a one time push of forces to a rigidbody

29
Q

The difference between KinematicBody and RigidBody is

A

rigidbody is meant to be moved by physics forces

KinematicBody is moved by move_and_collide and move_and_slide

30
Q

In order to move a KinematicBody2D while allowing it to collide, use

A

move_and_collide(vector)

31
Q

To prevent a rigidbody from rotate after impact

A

set it to character mode

32
Q

To start detecting clicks

A

Project -> project settings -> Type new name in top bar and click add -> Click plus next to new list item -> mouse button

func _unhandled_input(event):
if event.is_action_pressed(“Click”):
var soldier = SOLDIER_SCENE.instance()
soldier.position = get_viewport().get_mouse_position()
get_tree().get_root().get_child(0).add_child(soldier)

33
Q

To spawn nodes

A

first convert it to a scene, then
var soldier = load(‘../Scene.tscn’).instance()
get_tree().get_root().get_child(0).add_child(soldier)

34
Q

_unhandled_input is used

A

only to capture events that were not already captured by the event system

35
Q

To get the distance between 2 positions

A

position.distance_to(building.position))