8000 Merge pull request #198 from jfcharron/trigonometry · endlessm/godot-block-coding@2dfcf0d · GitHub
[go: up one dir, main page]

Skip to content

Commit 2dfcf0d

Browse files
authored
Merge pull request #198 from jfcharron/trigonometry
Adds sin, cos and tan trigonometry function
2 parents 28c3f0d + 9991c2a commit 2dfcf0d

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://c6g6ljp46lfrj"]
2+
3+
[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_lxbvo"]
4+
5+
[resource]
6+
script = ExtResource("1_lxbvo")
7+
name = &"cos"
8+
description = "Calculate the cosine of [i]angle[/i]"
9+
category = "Math"
10+
type = 3
11+
variant_type = 3
12+
display_template = "cos {angle: FLOAT}"
13+
code_template = "cos(deg_to_rad({angle}))"
14+
defaults = {
15+
"angle": 0.0
16+
}
17+
signal_name = ""
18+
scope = ""
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://b1r7f06rfci6o"]
2+
3+
[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_dlr47"]
4+
5+
[resource]
6+
script = ExtResource("1_dlr47")
7+
name = &"sin"
8+
description = "Calculate the sine of [i]angle[/i]"
9+
category = "Math"
10+
type = 3
11+
variant_type = 3
12+
display_template = "sin {angle: FLOAT}"
13+
code_template = "sin(deg_to_rad({angle}))"
14+
defaults = {
15+
"angle": 0.0
16+
}
17+
signal_name = ""
18+
scope = ""
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://blpo01pjjheqb"]
2+
3+
[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_e2566"]
4+
5+
[resource]
6+
script = ExtResource("1_e2566")
7+
name = &"tan"
8+
description = "Calculate the tangent of [i]angle[/i]"
9+
category = "Math"
10+
type = 3
11+
variant_type = 3
12+
display_template = "tan {angle: FLOAT}"
13+
code_template = "tan(deg_to_rad({angle}))"
14+
defaults = {
15+
"angle": 0.0
16+
}
17+
signal_name = ""
18+
scope = ""

addons/block_code/ui/picker/categories/category_factory.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ static func get_general_blocks() -> Array[Block]:
198198
block_list.append(b)
199199

200200
# Math
201-
for block_name in [&"add", &"subtract", &"multiply", &"divide", &"pow", &"randf_range", &"randi_range"]:
201+
for block_name in [&"add", &"subtract", &"multiply", &"divide", &"pow", &"randf_range", &"randi_range", &"sin", &"cos", &"tan"]:
202202
b = Util.instantiate_block(block_name)
203203
block_list.append(b)
204204

0 commit comments

Comments
 (0)
0