-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
223 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@tool | ||
class_name Paddle | ||
extends CharacterBody2D | ||
|
||
|
||
func get_class(): | ||
return "Paddle" | ||
|
||
static func get_base_class(): | ||
return "CharacterBody2D" | ||
|
||
|
||
static func get_exposed_properties() -> Array[String]: | ||
return ["position"] | ||
|
||
|
||
static func get_custom_blocks() -> Array[BlockCategory]: | ||
var b: Block | ||
|
||
# Movement | ||
var movement_list: Array[Block] = [] | ||
b = CategoryFactory.BLOCKS["statement_block"].instantiate() | ||
b.block_type = Types.BlockType.EXECUTE | ||
b.block_format = "Move with player 1 buttons, speed {speed: INT}" | ||
b.statement = 'velocity = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")*{speed}\n' + "move_and_slide()" | ||
movement_list.append(b) | ||
|
||
b = CategoryFactory.BLOCKS["statement_block"].instantiate() | ||
b.block_type = Types.BlockType.EXECUTE | ||
b.block_format = "Move with player 2 buttons, speed {speed: INT}" | ||
b.statement = 'velocity = Input.get_vector("player_2_left", "player_2_right", "player_2_up", "player_2_down")*{speed}\n' + "move_and_slide()" | ||
movement_list.append(b) | ||
|
||
var movement_cat: BlockCategory = BlockCategory.new("Movement", movement_list, Color("4a86d5")) | ||
|
||
return [movement_cat] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://tplpgtnfeda0" | ||
path="res://.godot/imported/paddle.png-2fbcaaf37bbbddd482a4ad5b20dde0a2.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://pong_game/paddle.png" | ||
dest_files=["res://.godot/imported/paddle.png-2fbcaaf37bbbddd482a4ad5b20dde0a2.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
compress/hdr_compression=1 | ||
compress/normal_map=0 | ||
compress/channel_pack=0 | ||
mipmaps/generate=false | ||
mipmaps/limit=-1 | ||
roughness/mode=0 | ||
roughness/src_normal="" | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/normal_map_invert_y=false | ||
process/hdr_as_srgb=false | ||
process/hdr_clamp_exposure=false | ||
process/size_limit=0 | ||
detect_3d/compress_to=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[gd_scene load_steps=4 format=3 uid="uid://s7enbp56f256"] | ||
|
||
[ext_resource type="Script" path="res://pong_game/paddle.gd" id="1_74lee"] | ||
[ext_resource type="Texture2D" uid="uid://tplpgtnfeda0" path="res://pong_game/paddle.png" id="1_eucti"] | ||
|
||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bbbjr"] | ||
size = Vector2(128, 384) | ||
|
||
[node name="Paddle" type="CharacterBody2D" groups=["paddles"]] | ||
collision_mask = 68 | ||
motion_mode = 1 | ||
script = ExtResource("1_74lee") | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] | ||
shape = SubResource("RectangleShape2D_bbbjr") | ||
|
||
[node name="Sprite2D" type="Sprite2D" parent="."] | ||
unique_name_in_owner = true | ||
texture = ExtResource("1_eucti") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
[gd_scene load_steps=19 format=3 uid="uid://tf7b8c64ecc0"] | ||
|
||
[ext_resource type="PackedScene" uid="uid://s7enbp56f256" path="res://pong_game/paddle.tscn" id="1_1k5k2"] | ||
[ext_resource type="Script" path="res://addons/block_code/block_code_node/block_code.gd" id="3_6jaq8"] | ||
[ext_resource type="Script" path="res://addons/block_code/ui/block_canvas/serialized_block_tree_node.gd" id="4_qtggh"] | ||
[ext_resource type="Script" path="res://addons/block_code/ui/block_canvas/serialized_block.gd" id="5_wr38c"] | ||
[ext_resource type="Script" path="res://addons/block_code/ui/block_canvas/serialized_block_tree_node_array.gd" id="6_ppdc3"] | ||
[ext_resource type="Script" path="res://addons/block_code/block_script_data/block_script_data.gd" id="7_uuuue"] | ||
|
||
[sub_resource type="Resource" id="Resource_3ils6"] | ||
script = ExtResource("5_wr38c") | ||
block_class = &"StatementBlock" | ||
serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.290196, 0.52549, 0.835294, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["block_format", "Move with player 2 buttons, speed {speed: INT}"], ["statement", "velocity = Input.get_vector(\"player_2_left\", \"player_2_right\", \"player_2_up\", \"player_2_down\")*{speed} | ||
move_and_slide()"], ["param_input_strings", { | ||
"speed": "500" | ||
}]] | ||
|
||
[sub_resource type="Resource" id="Resource_qd5oi"] | ||
script = ExtResource("4_qtggh") | ||
serialized_block = SubResource("Resource_3ils6") | ||
path_child_pairs = [] | ||
|
||
[sub_resource type="Resource" id="Resource_vjq0g"] | ||
script = ExtResource("5_wr38c") | ||
block_class = &"EntryBlock" | ||
serialized_props = [["block_name", "process_block"], ["label", "EntryBlock"], ["color", Color(0.980392, 0.34902, 0.337255, 1)], ["block_type", 1], ["position", Vector2(53, 164)], ["block_format", "On Process"], ["statement", "func _process(delta):"], ["param_input_strings", {}]] | ||
|
||
[sub_resource type="Resource" id="Resource_dkmie"] | ||
script = ExtResource("4_qtggh") | ||
serialized_block = SubResource("Resource_vjq0g") | ||
path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_qd5oi")]] | ||
|
||
[sub_resource type="Resource" id="Resource_1q8dn"] | ||
script = ExtResource("6_ppdc3") | ||
array = Array[ExtResource("4_qtggh")]([SubResource("Resource_dkmie")]) | ||
|
||
[sub_resource type="Resource" id="Resource_t7nl4"] | ||
script = ExtResource("7_uuuue") | ||
script_inherits = "Paddle" | ||
block_trees = SubResource("Resource_1q8dn") | ||
generated_script = "extends Paddle | ||
var VAR_DICT := {} | ||
func _process(delta): | ||
velocity = Input.get_vector(\"player_2_left\", \"player_2_right\", \"player_2_up\", \"player_2_down\")*500 | ||
move_and_slide() | ||
" | ||
|
||
[sub_resource type="Resource" id="Resource_xj1ks"] | ||
script = ExtResource("5_wr38c") | ||
block_class = &"StatementBlock" | ||
serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.290196, 0.52549, 0.835294, 1)], ["block_type", 2], ["position", Vector2(0, 0)], ["block_format", "Move with player 1 buttons, speed {speed: INT}"], ["statement", "velocity = Input.get_vector(\"ui_left\", \"ui_right\", \"ui_up\", \"ui_down\")*{speed} | ||
move_and_slide()"], ["param_input_strings", { | ||
"speed": "500" | ||
}]] | ||
|
||
[sub_resource type="Resource" id="Resource_r1oo8"] | ||
script = ExtResource("4_qtggh") | ||
serialized_block = SubResource("Resource_xj1ks") | ||
path_child_pairs = [] | ||
|
||
[sub_resource type="Resource" id="Resource_3hvmm"] | ||
script = ExtResource("5_wr38c") | ||
block_class = &"EntryBlock" | ||
serialized_props = [["block_name", "process_block"], ["label", "EntryBlock"], ["color", Color(0.980392, 0.34902, 0.337255, 1)], ["block_type", 1], ["position", Vector2(90, 95)], ["block_format", "On Process"], ["statement", "func _process(delta):"], ["param_input_strings", {}]] | ||
|
||
[sub_resource type="Resource" id="Resource_owydw"] | ||
script = ExtResource("4_qtggh") | ||
serialized_block = SubResource("Resource_3hvmm") | ||
path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_r1oo8")]] | ||
|
||
[sub_resource type="Resource" id="Resource_4hv2q"] | ||
script = ExtResource("6_ppdc3") | ||
array = Array[ExtResource("4_qtggh")]([SubResource("Resource_owydw")]) | ||
|
||
[sub_resource type="Resource" id="Resource_52r02"] | ||
script = ExtResource("7_uuuue") | ||
script_inherits = "Paddle" | ||
block_trees = SubResource("Resource_4hv2q") | ||
generated_script = "extends Paddle | ||
var VAR_DICT := {} | ||
func _process(delta): | ||
velocity = Input.get_vector(\"ui_left\", \"ui_right\", \"ui_up\", \"ui_down\")*500 | ||
move_and_slide() | ||
" | ||
|
||
[node name="Node2D" type="Node2D"] | ||
|
||
[node name="Paddle" parent="." instance=ExtResource("1_1k5k2")] | ||
modulate = Color(1, 0.653955, 0.477429, 1) | ||
position = Vector2(326, 313) | ||
scale = Vector2(0.603749, 0.603749) | ||
|
||
[node name="BlockCode" type="Node" parent="Paddle"] | ||
script = ExtResource("3_6jaq8") | ||
bsd = SubResource("Resource_t7nl4") | ||
|
||
[node name="Paddle2" parent="." instance=ExtResource("1_1k5k2")] | ||
modulate = Color(0.681415, 0.928494, 0.956385, 1) | ||
position = Vector2(875, 313) | ||
scale = Vector2(0.603749, 0.603749) | ||
|
||
[node name="BlockCode" type="Node" parent="Paddle2"] | ||
script = ExtResource("3_6jaq8") | ||
bsd = SubResource("Resource_52r02") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters