diff options
-rw-r--r-- | godot/assets/fonts/format.otf | bin | 0 -> 18820 bytes | |||
-rw-r--r-- | godot/assets/fonts/format.tres | 7 | ||||
-rw-r--r-- | godot/assets/sounds/Uuhhh.mp3.import | 4 | ||||
-rw-r--r-- | godot/assets/theme.tres | 47 | ||||
-rw-r--r-- | godot/project.godot | 12 | ||||
-rw-r--r-- | godot/scenes/Die.gd | 66 | ||||
-rw-r--r-- | godot/scenes/Die.tscn (renamed from godot/scenes/objects/W8.tscn) | 21 | ||||
-rw-r--r-- | godot/scenes/Game.gd | 31 | ||||
-rw-r--r-- | godot/scenes/Game.tscn | 59 | ||||
-rw-r--r-- | godot/scenes/Menu.gd | 25 | ||||
-rw-r--r-- | godot/scenes/Menu.tscn | 42 | ||||
-rw-r--r-- | godot/scenes/levels/test_scene_movement/TestSceneMovement.tscn | 5 | ||||
-rw-r--r-- | godot/scenes/levels/test_scene_uuuhhh/TestSceneUuuhhh.tscn | 4 | ||||
-rw-r--r-- | godot/scenes/objects/Player.tscn | 18 | ||||
-rw-r--r-- | godot/scenes/objects/old/Die.tscn | 11 | ||||
-rw-r--r-- | godot/scenes/scripts/roblox-cube.gd | 22 | ||||
-rw-r--r-- | rust/src/game.rs | 44 | ||||
-rw-r--r-- | rust/src/lib.rs | 8 | ||||
-rw-r--r-- | rust/src/spinning_cube.rs | 58 | ||||
-rw-r--r-- | rust/src/test.rs | 58 |
20 files changed, 334 insertions, 208 deletions
diff --git a/godot/assets/fonts/format.otf b/godot/assets/fonts/format.otf Binary files differnew file mode 100644 index 0000000..129be34 --- /dev/null +++ b/godot/assets/fonts/format.otf diff --git a/godot/assets/fonts/format.tres b/godot/assets/fonts/format.tres new file mode 100644 index 0000000..9020d9c --- /dev/null +++ b/godot/assets/fonts/format.tres @@ -0,0 +1,7 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/fonts/format.otf" type="DynamicFontData" id=1] + +[resource] +size = 50 +font_data = ExtResource( 1 ) diff --git a/godot/assets/sounds/Uuhhh.mp3.import b/godot/assets/sounds/Uuhhh.mp3.import index 4044597..cbe7703 100644 --- a/godot/assets/sounds/Uuhhh.mp3.import +++ b/godot/assets/sounds/Uuhhh.mp3.import @@ -2,13 +2,11 @@ importer="mp3" type="AudioStreamMP3" -path="res://.import/Uuhhh.mp3-1452b4c6d720c509ff34f445446a352e.mp3str" +valid=false [deps] source_file="res://assets/sounds/Uuhhh.mp3" -dest_files=[ "res://.import/Uuhhh.mp3-1452b4c6d720c509ff34f445446a352e.mp3str" ] - [params] loop=true diff --git a/godot/assets/theme.tres b/godot/assets/theme.tres new file mode 100644 index 0000000..1269b54 --- /dev/null +++ b/godot/assets/theme.tres @@ -0,0 +1,47 @@ +[gd_resource type="Theme" load_steps=10 format=2] + +[ext_resource path="res://assets/fonts/format.otf" type="DynamicFontData" id=1] +[ext_resource path="res://assets/fonts/format.tres" type="DynamicFont" id=2] + +[sub_resource type="DynamicFont" id=1] +size = 55 +extra_spacing_bottom = -15 +font_data = ExtResource( 1 ) + +[sub_resource type="StyleBoxFlat" id=2] +content_margin_top = 10.0 +content_margin_bottom = 10.0 +bg_color = Color( 0.4, 0.337255, 0.313726, 0.32549 ) + +[sub_resource type="StyleBoxFlat" id=3] +content_margin_top = 10.0 +content_margin_bottom = 10.0 +bg_color = Color( 0.176471, 0.14902, 0.141176, 1 ) + +[sub_resource type="StyleBoxFlat" id=4] +content_margin_top = 10.0 +content_margin_bottom = 10.0 +bg_color = Color( 0.4, 0.337255, 0.313726, 1 ) + +[sub_resource type="StyleBoxFlat" id=5] +content_margin_top = 20.0 +content_margin_bottom = 20.0 +bg_color = Color( 0.290196, 0.247059, 0.231373, 1 ) + +[sub_resource type="StyleBoxFlat" id=6] +content_margin_top = 10.0 +content_margin_bottom = 10.0 +bg_color = Color( 0.176471, 0.14902, 0.141176, 1 ) + +[sub_resource type="StyleBoxFlat" id=7] +bg_color = Color( 0.160784, 0.133333, 0.133333, 1 ) + +[resource] +Button/fonts/font = SubResource( 1 ) +Button/styles/disabled = SubResource( 2 ) +Button/styles/focus = SubResource( 3 ) +Button/styles/hover = SubResource( 4 ) +Button/styles/normal = SubResource( 5 ) +Button/styles/pressed = SubResource( 6 ) +Label/fonts/font = ExtResource( 2 ) +Panel/styles/panel = SubResource( 7 ) diff --git a/godot/project.godot b/godot/project.godot index 0191f34..e98a5a8 100644 --- a/godot/project.godot +++ b/godot/project.godot @@ -15,9 +15,15 @@ _global_script_class_icons={ [application] config/name="code-with-your-friends2022" -run/main_scene="res://scenes/Game.tscn" +run/main_scene="res://scenes/Menu.tscn" config/icon="res://assets/godot-ferris-32x32.png" +[display] + +window/size/width=1920 +window/size/height=1080 +window/stretch/mode="2d" + [gdnative] singletons=[ ] @@ -29,6 +35,10 @@ mouse_btn_left={ "events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null) ] } +esc={ +"deadzone": 0.5, +"events": [ ] +} [rendering] diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd new file mode 100644 index 0000000..5e238f1 --- /dev/null +++ b/godot/scenes/Die.gd @@ -0,0 +1,66 @@ +extends Spatial + +var camrot_h = 0 +var camrot_v = 0 +var camrot_v_locked_val = 0 +var cam_v_min = -90 +var cam_v_max = 90 +var sensitivity = 0.5 +var dice_is_moving = false +var last_frame_position = Vector3(1.0,1.0,1.0) +var dragging = false +var mouse_origin = Vector2(0,0) +var dice_launch_force = 0 + +# Called when the node enters the scene tree for the first time. +func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + $CamRoot/Horizontal/Vertical/Camera.add_exception(self) + $CamRoot.set_as_toplevel(true) + + +func _input(event): + if event is InputEventMouseMotion: + camrot_h += -event.relative.x * sensitivity + camrot_v += -event.relative.y * sensitivity + + if dice_is_moving == false: + if event is InputEventMouseMotion and dragging: + # While dragging, move the sprite with the mouse. + dice_launch_force = mouse_origin.distance_to(event.global_position) + camrot_v = camrot_v_locked_val + elif event is InputEventMouseButton and event.button_index == BUTTON_LEFT: + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + mouse_origin = event.global_position + camrot_v_locked_val = camrot_v + if not dragging and event.pressed: + dragging = true + # Stop dragging if the button is released. + elif dragging and not event.pressed: + dragging = false + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + + + + + +func _physics_process(delta): + camrot_v = clamp(camrot_v, cam_v_min, cam_v_max) + + $CamRoot/Horizontal.rotation_degrees.y = camrot_h + $CamRoot/Horizontal/Vertical.rotation_degrees.x = camrot_v + $CamRoot.translation.x = translation.x + $CamRoot.translation.y = translation.y + $CamRoot.translation.z = translation.z + + if last_frame_position != Vector3(translation.x, translation.y, translation.x): + dice_is_moving = true + else: + dice_is_moving = false + + last_frame_position = Vector3(translation.x, translation.y, translation.x) + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass diff --git a/godot/scenes/objects/W8.tscn b/godot/scenes/Die.tscn index 8766011..57594ed 100644 --- a/godot/scenes/objects/W8.tscn +++ b/godot/scenes/Die.tscn @@ -1,5 +1,10 @@ +<<<<<<< HEAD:godot/scenes/objects/W8.tscn [gd_scene load_steps=6 format=2] +======= +[gd_scene load_steps=5 format=2] +>>>>>>> menu:godot/scenes/Die.tscn +[ext_resource path="res://scenes/Die.gd" type="Script" id=1] [ext_resource path="res://assets/game_objects/W8baseColor_Mat.material" type="Material" id=2] [sub_resource type="ArrayMesh" id=1] @@ -20,11 +25,16 @@ surfaces/0 = { [sub_resource type="ConvexPolygonShape" id=2] points = PoolVector3Array( -0.0850063, -0.879389, -0.0282584, 0.0288993, 0.929375, 0.0289349, 0.0288993, 0.929375, -0.0289349, 0.929367, -0.0289314, 0.0289314, -0.0289784, -0.0289338, 0.929338, -0.929369, 0.028929, 0.028929, 0.0288993, -0.0289349, -0.929375, 0.0288993, -0.929375, 0.0289349, -0.0850063, 0.0282584, -0.879389, 0.0282247, 0.084959, 0.87945, 0.857489, 0.056933, -0.0855785, -0.879454, -0.0849424, 0.0282549, 0.0570775, -0.885814, -0.0571088, 0.0570775, -0.0571088, 0.885814, -0.0571532, 0.885743, -0.0571043, -0.0571532, 0.885743, 0.0571043, 0.0570775, 0.0571088, -0.885814, -0.885806, -0.057097, -0.057097, 0.879446, 0.0849494, 0.0282572, 0.857335, -0.0571018, -0.0855632, -0.0571532, 0.0571043, 0.885743, -0.0571532, -0.885743, 0.0571043, -0.885806, 0.057097, -0.057097, -0.0571532, -0.0571043, -0.885743, 0.0570775, 0.0571088, 0.885814, -0.0571532, -0.885743, -0.0571043, -0.0571532, 0.0571043, -0.885743, 0.0570775, -0.885814, 0.0571088, 0.0570775, 0.885814, 0.0571088, -0.0571532, -0.0571043, 0.885743, -0.885806, 0.057097, 0.057097, 0.0570775, 0.885814, -0.0571088, 0.0570775, -0.0571088, -0.885814, 0.857335, -0.0571018, 0.0855632, -0.885806, -0.057097, 0.057097, 0.857489, 0.056933, 0.0855785, 0.929425, 0.0287513, -0.0289333, 0.929367, -0.0289314, -0.0289314, -0.0289784, 0.929338, -0.0289338, 0.0288993, 0.0289349, -0.929375, -0.929369, -0.028929, -0.028929, -0.0283039, -0.87942, -0.0849561, 0.084933, 0.0282608, 0.879461, -0.0289784, 0.929338, 0.0289338, -0.0289784, -0.0289338, -0.929338, -0.0289784, 0.0289338, 0.929338, 0.0288993, -0.0289349, 0.929375, 0.0288993, -0.929375, -0.0289349, -0.0289784, -0.929338, 0.0289338, -0.929369, 0.028929, -0.028929, -0.0283039, 0.0849561, -0.87942, -0.879454, -0.0282549, 0.0849424, 0.879512, 0.0280816, 0.0849558, 0.879446, -0.0849494, -0.0282572, -0.0282988, -0.822574, 0.141805, 0.17021, 0.0280745, -0.794261, -0.879454, 0.0849424, -0.0282549, -0.0283039, 0.87942, 0.0849561, 0.0282247, 0.87945, -0.084959, 0.0282247, -0.084959, -0.87945, -0.879454, -0.0282549, -0.0849424, -0.0850063, 0.0282584, 0.879389, -0.0850063, 0.879389, 0.0282584, 0.084933, -0.0282608, 0.879461 ) +<<<<<<< HEAD:godot/scenes/objects/W8.tscn [sub_resource type="SphereShape" id=3] [sub_resource type="SphereMesh" id=4] [node name="RigidBody" type="RigidBody"] +======= +[node name="Die" type="RigidBody"] +script = ExtResource( 1 ) +>>>>>>> menu:godot/scenes/Die.tscn [node name="MeshDie" type="MeshInstance" parent="."] mesh = SubResource( 1 ) @@ -34,6 +44,7 @@ material/0 = null [node name="CollisionShapeDie" type="CollisionShape" parent="."] shape = SubResource( 2 ) +<<<<<<< HEAD:godot/scenes/objects/W8.tscn [node name="CollisionShapeSphere" type="CollisionShape" parent="."] transform = Transform( 0.7, 0, 0, 0, 0.7, 0, 0, 0, 0.7, 0, 0, 0 ) shape = SubResource( 3 ) @@ -44,3 +55,13 @@ transform = Transform( 0.7, 0, 0, 0, 0.7, 0, 0, 0, 0.7, 0, 0, 0 ) visible = false mesh = SubResource( 4 ) material/0 = ExtResource( 2 ) +======= +[node name="CamRoot" type="Spatial" parent="."] + +[node name="Horizontal" type="Spatial" parent="CamRoot"] + +[node name="Vertical" type="Spatial" parent="CamRoot/Horizontal"] + +[node name="Camera" type="ClippedCamera" parent="CamRoot/Horizontal/Vertical"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 10.1285 ) +>>>>>>> menu:godot/scenes/Die.tscn diff --git a/godot/scenes/Game.gd b/godot/scenes/Game.gd new file mode 100644 index 0000000..31e543d --- /dev/null +++ b/godot/scenes/Game.gd @@ -0,0 +1,31 @@ +extends Spatial + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + if Input.is_action_just_pressed("ui_cancel"): + get_tree().paused = true + $PausePopup.show() + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + + + + +func _on_QuitButton_pressed(): + get_tree().quit() + + +func _on_ResumeButton_pressed(): + $PausePopup.hide() + get_tree().paused = false + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) diff --git a/godot/scenes/Game.tscn b/godot/scenes/Game.tscn index 38a4ceb..710e5b5 100644 --- a/godot/scenes/Game.tscn +++ b/godot/scenes/Game.tscn @@ -1,3 +1,4 @@ +<<<<<<< HEAD [gd_scene load_steps=8 format=2] [ext_resource path="res://native/Game.gdns" type="Script" id=1] @@ -9,6 +10,14 @@ [sub_resource type="CubeMesh" id=2] [sub_resource type="SphereMesh" id=3] +======= +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://scenes/Game.gd" type="Script" id=1] +[ext_resource path="res://scenes/levels/test_scene_movement/TestSceneMovement.tscn" type="PackedScene" id=2] +[ext_resource path="res://assets/theme.tres" type="Theme" id=3] +[ext_resource path="res://assets/fonts/format.tres" type="DynamicFont" id=4] +>>>>>>> menu [node name="Game" type="Spatial"] script = ExtResource( 1 ) @@ -38,3 +47,53 @@ input/camera_mouse_sensitivity = Vector2( 0.005, 0.005 ) input/shoot_sensitivity = 0.005 [node name="TestScene" parent="." instance=ExtResource( 2 )] + +[node name="PausePopup" type="Control" parent="."] +pause_mode = 2 +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_right = 40.0 +margin_bottom = 40.0 + +[node name="Panel" type="Panel" parent="PausePopup"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 300.0 +margin_top = 200.0 +margin_right = -300.0 +margin_bottom = -200.0 +theme = ExtResource( 3 ) + +[node name="Label" type="Label" parent="PausePopup/Panel"] +anchor_right = 1.0 +anchor_bottom = 0.3 +theme = ExtResource( 3 ) +custom_fonts/font = ExtResource( 4 ) +text = "Game is Paused" +align = 1 +valign = 1 + +[node name="VBoxContainer" type="VBoxContainer" parent="PausePopup/Panel"] +anchor_top = 0.3 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 500.0 +margin_right = -500.0 +custom_constants/separation = 20 +alignment = 1 + +[node name="ResumeButton" type="Button" parent="PausePopup/Panel/VBoxContainer"] +margin_top = 161.0 +margin_right = 360.0 +margin_bottom = 242.0 +text = "Resume" + +[node name="QuitButton" type="Button" parent="PausePopup/Panel/VBoxContainer"] +margin_top = 262.0 +margin_right = 360.0 +margin_bottom = 343.0 +text = "Quit" + +[connection signal="pressed" from="PausePopup/Panel/VBoxContainer/ResumeButton" to="." method="_on_ResumeButton_pressed"] +[connection signal="pressed" from="PausePopup/Panel/VBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"] diff --git a/godot/scenes/Menu.gd b/godot/scenes/Menu.gd new file mode 100644 index 0000000..2634e37 --- /dev/null +++ b/godot/scenes/Menu.gd @@ -0,0 +1,25 @@ +extends Control + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + + +func _on_StartButton_pressed(): + get_tree().change_scene("res://scenes/Game.tscn") + + + +func _on_QuitButton_pressed(): + get_tree().quit() diff --git a/godot/scenes/Menu.tscn b/godot/scenes/Menu.tscn new file mode 100644 index 0000000..5529448 --- /dev/null +++ b/godot/scenes/Menu.tscn @@ -0,0 +1,42 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://assets/theme.tres" type="Theme" id=1] +[ext_resource path="res://scenes/Menu.gd" type="Script" id=2] + +[node name="Menu" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 2 ) + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +anchor_right = 0.25 +anchor_bottom = 1.0 +margin_left = 40.0 +margin_top = 789.0 +margin_bottom = -40.0 +theme = ExtResource( 1 ) +alignment = 2 + +[node name="StartButton" type="Button" parent="VBoxContainer"] +margin_top = 85.0 +margin_right = 440.0 +margin_bottom = 166.0 +focus_neighbour_top = NodePath("../QuitButton") +text = "Start" + +[node name="LevelButton" type="Button" parent="VBoxContainer"] +visible = false +margin_top = 85.0 +margin_right = 440.0 +margin_bottom = 166.0 +text = "Levels" + +[node name="QuitButton" type="Button" parent="VBoxContainer"] +margin_top = 170.0 +margin_right = 440.0 +margin_bottom = 251.0 +focus_neighbour_bottom = NodePath("../StartButton") +text = "Quit" + +[connection signal="pressed" from="VBoxContainer/StartButton" to="." method="_on_StartButton_pressed"] +[connection signal="pressed" from="VBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"] diff --git a/godot/scenes/levels/test_scene_movement/TestSceneMovement.tscn b/godot/scenes/levels/test_scene_movement/TestSceneMovement.tscn index d23236b..dc25498 100644 --- a/godot/scenes/levels/test_scene_movement/TestSceneMovement.tscn +++ b/godot/scenes/levels/test_scene_movement/TestSceneMovement.tscn @@ -2,7 +2,7 @@ [ext_resource path="res://scenes/levels/test_scene_uuuhhh/Wall.tscn" type="PackedScene" id=1] [ext_resource path="res://scenes/levels/test_scene_uuuhhh/Floor.tscn" type="PackedScene" id=2] -[ext_resource path="res://scenes/objects/Player.tscn" type="PackedScene" id=3] +[ext_resource path="res://scenes/Die.tscn" type="PackedScene" id=3] [node name="TestScene" type="Spatial"] @@ -27,4 +27,5 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 40, -1, -20 ) [node name="Wall" parent="." instance=ExtResource( 1 )] transform = Transform( 0.766044, 0, 0.642788, 0, 2, 0, -0.642788, 0, 0.766044, 19.47, 0, -14 ) -[node name="PlayerRoot" parent="." instance=ExtResource( 3 )] +[node name="Die" parent="." instance=ExtResource( 3 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.759363, 4.18965, -3.60846 ) diff --git a/godot/scenes/levels/test_scene_uuuhhh/TestSceneUuuhhh.tscn b/godot/scenes/levels/test_scene_uuuhhh/TestSceneUuuhhh.tscn index 0e4c8dc..c1c8707 100644 --- a/godot/scenes/levels/test_scene_uuuhhh/TestSceneUuuhhh.tscn +++ b/godot/scenes/levels/test_scene_uuuhhh/TestSceneUuuhhh.tscn @@ -3,6 +3,10 @@ [ext_resource path="res://scenes/levels/test_scene_uuuhhh/Wall.tscn" type="PackedScene" id=1] [ext_resource path="res://scenes/levels/test_scene_uuuhhh/Floor.tscn" type="PackedScene" id=2] [ext_resource path="res://assets/sounds/Uuhhh.mp3" type="AudioStream" id=4] +<<<<<<< HEAD +======= +[ext_resource path="res://scenes/Die.tscn" type="PackedScene" id=5] +>>>>>>> menu [node name="TestScene" type="Spatial"] diff --git a/godot/scenes/objects/Player.tscn b/godot/scenes/objects/Player.tscn deleted file mode 100644 index cc3662e..0000000 --- a/godot/scenes/objects/Player.tscn +++ /dev/null @@ -1,18 +0,0 @@ -[gd_scene load_steps=4 format=2] - -[ext_resource path="res://scenes/objects/W8.tscn" type="PackedScene" id=1] -[ext_resource path="res://scenes/objects/Camera.tscn" type="PackedScene" id=2] -[ext_resource path="res://native/BasicDie.gdns" type="Script" id=3] - -[node name="PlayerRoot" type="Spatial"] -script = ExtResource( 3 ) -camera/camera_clamp = Vector2( 0, -1.3 ) -shooting/max_force = 30.0 -shooting/up_angle = 0.3 -shooting/stopping_velocity = 0.003 - -[node name="W8" parent="." instance=ExtResource( 1 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.1, 0 ) - -[node name="Camera" parent="." instance=ExtResource( 2 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0 ) diff --git a/godot/scenes/objects/old/Die.tscn b/godot/scenes/objects/old/Die.tscn new file mode 100644 index 0000000..cab0d15 --- /dev/null +++ b/godot/scenes/objects/old/Die.tscn @@ -0,0 +1,11 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://scenes/Die.tscn" type="PackedScene" id=1] + +[node name="Die" type="Spatial"] + +[node name="Die" parent="." instance=ExtResource( 1 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.1, 0 ) + +[node name="CamRoot" type="Spatial" parent="Die"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.1, 0 ) diff --git a/godot/scenes/scripts/roblox-cube.gd b/godot/scenes/scripts/roblox-cube.gd deleted file mode 100644 index 453067b..0000000 --- a/godot/scenes/scripts/roblox-cube.gd +++ /dev/null @@ -1,22 +0,0 @@ -extends Spatial - - -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" -func on_collision(other): - var ap = get_parent().get_node("AudioStreamPlayer") - ap.play() - - -# Called when the node enters the scene tree for the first time. -func _ready(): - var rb = self - rb.apply_impulse(Vector3(), Vector3(40, 1, 10)) - rb.connect("body_entered", self, "on_collision") - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass - diff --git a/rust/src/game.rs b/rust/src/game.rs deleted file mode 100644 index 61b23ed..0000000 --- a/rust/src/game.rs +++ /dev/null @@ -1,44 +0,0 @@ -use gdnative::api::*; -use gdnative::prelude::*; - -/// The Game "class" -#[derive(NativeClass)] -#[inherit(Spatial)] -#[register_with(Self::register_builder)] -pub struct Game { - name: String, -} - -// __One__ `impl` block can have the `#[methods]` attribute, which will generate -// code to automatically bind any exported methods to Godot. -#[methods] -impl Game { - // Register the builder for methods, properties and/or signals. - fn register_builder(_builder: &ClassBuilder<Self>) { - godot_print!("Game builder is registered!"); - } - - /// The "constructor" of the class. - fn new(_owner: &Spatial) -> Self { - godot_print!("Game is created!"); - Game { - name: "".to_string(), - } - } - - // In order to make a method known to Godot, the #[export] attribute has to be used. - // In Godot script-classes do not actually inherit the parent class. - // Instead they are "attached" to the parent object, called the "owner". - // The owner is passed to every single exposed method. - #[export] - unsafe fn _ready(&mut self, _owner: &Spatial) { - // The `godot_print!` macro works like `println!` but prints to the Godot-editor - // output tab as well. - self.name = "Game".to_string(); - godot_print!("{} is ready!", self.name); - } - - // This function will be called in every frame - #[export] - unsafe fn _process(&self, _owner: &Spatial, _delta: f64) { } -} diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 1be319a..c8afc06 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -1,22 +1,26 @@ -mod game; -mod spinning_cube; mod buff_bounce; mod buff_phase; mod buff_trait; mod buff_ball; mod buff_extra; +<<<<<<< HEAD pub mod goal_trigger; mod test; +======= +>>>>>>> menu mod basic_die; use gdnative::prelude::{godot_init, InitHandle}; // Function that registers all exposed classes to Godot fn init(handle: InitHandle) { +<<<<<<< HEAD handle.add_class::<game::Game>(); handle.add_class::<spinning_cube::SpinningCube>(); handle.add_class::<goal_trigger::GoalTriggerZone>(); handle.add_class::<test::SpinningCubeReverse>(); +======= +>>>>>>> menu handle.add_class::<basic_die::BasicDie>(); } diff --git a/rust/src/spinning_cube.rs b/rust/src/spinning_cube.rs deleted file mode 100644 index 41b429f..0000000 --- a/rust/src/spinning_cube.rs +++ /dev/null @@ -1,58 +0,0 @@ -use gdnative::api::*; -use gdnative::prelude::*; - -/// The SpinningCube "class" -#[derive(NativeClass)] -#[inherit(MeshInstance)] -#[register_with(Self::register_builder)] -pub struct SpinningCube { - start: Vector3, - time: f32, - #[property(path = "base/rotate_speed")] - rotate_speed: f64, -} - -// __One__ `impl` block can have the `#[methods]` attribute, which will generate -// code to automatically bind any exported methods to Godot. -#[methods] -impl SpinningCube { - // Register the builder for methods, properties and/or signals. - fn register_builder(_builder: &ClassBuilder<Self>) { - godot_print!("SpinningCube builder is registered!"); - } - - /// The "constructor" of the class. - fn new(_owner: &MeshInstance) -> Self { - SpinningCube { - start: Vector3::new(0.0, 0.0, 0.0), - time: 0.0, - rotate_speed: 0.05, - } - } - - // In order to make a method known to Godot, the #[export] attribute has to be used. - // In Godot script-classes do not actually inherit the parent class. - // Instead they are "attached" to the parent object, called the "owner". - // The owner is passed to every single exposed method. - #[export] - unsafe fn _ready(&mut self, owner: &MeshInstance) { - owner.set_physics_process(true); - } - - #[export] - unsafe fn _physics_process(&mut self, owner: &MeshInstance, delta: f64) { - use gdnative::api::SpatialMaterial; - - self.time += delta as f32; - owner.rotate_y(self.rotate_speed * delta); - - let offset = Vector3::new(0.0, 1.0, 0.0) * self.time.cos() * 0.5; - owner.set_translation(self.start + offset); - - if let Some(mat) = owner.get_surface_material(0) { - let mat = mat.assume_safe(); - let mat = mat.cast::<SpatialMaterial>().expect("Incorrect material"); - mat.set_albedo(Color::from_rgba(self.time.cos().abs(), 0.0, 0.0, 1.0)); - } - } -} diff --git a/rust/src/test.rs b/rust/src/test.rs deleted file mode 100644 index 6c0774f..0000000 --- a/rust/src/test.rs +++ /dev/null @@ -1,58 +0,0 @@ -use gdnative::api::*; -use gdnative::prelude::*; - -/// The SpinningCube "class" -#[derive(NativeClass)] -#[inherit(MeshInstance)] -#[register_with(Self::register_builder)] -pub struct SpinningCubeReverse { - start: Vector3, - time: f32, - #[property(path = "base/rotate_speed")] - rotate_speed: f64, -} - -// __One__ `impl` block can have the `#[methods]` attribute, which will generate -// code to automatically bind any exported methods to Godot. -#[methods] -impl SpinningCubeReverse { - // Register the builder for methods, properties and/or signals. - fn register_builder(_builder: &ClassBuilder<Self>) { - godot_print!("SpinningCube builder is registered!"); - } - - /// The "constructor" of the class. - fn new(_owner: &MeshInstance) -> Self { - SpinningCubeReverse { - start: Vector3::new(0.0, 0.0, 0.0), - time: 0.0, - rotate_speed: 0.05, - } - } - - // In order to make a method known to Godot, the #[export] attribute has to be used. - // In Godot script-classes do not actually inherit the parent class. - // Instead they are "attached" to the parent object, called the "owner". - // The owner is passed to every single exposed method. - #[export] - unsafe fn _ready(&mut self, owner: &MeshInstance) { - owner.set_physics_process(true); - } - - #[export] - unsafe fn _physics_process(&mut self, owner: &MeshInstance, delta: f64) { - use gdnative::api::SpatialMaterial; - - self.time += delta as f32; - owner.rotate_y(self.rotate_speed * delta * -1.0); - - let offset = Vector3::new(0.0, 1.0, 0.0) * self.time.cos() * 0.5; - owner.set_translation(self.start + offset); - - if let Some(mat) = owner.get_surface_material(0) { - let mat = mat.assume_safe(); - let mat = mat.cast::<SpatialMaterial>().expect("Incorrect material"); - mat.set_albedo(Color::from_rgba(self.time.cos().abs(), 0.0, 0.0, 1.0)); - } - } -} |