mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-07-12 18:43:49 +00:00
chore(*): Remove redundant files
This commit is contained in:
@@ -1,22 +0,0 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://cf1pwgl0y0mi6"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bjpyemep3etrk" path="res://objects/Player Controller/PlayerController.gd" id="1_krxqb"]
|
|
||||||
|
|
||||||
[sub_resource type="BoxMesh" id="BoxMesh_b7em5"]
|
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_b7em5"]
|
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody3D"]
|
|
||||||
script = ExtResource("1_krxqb")
|
|
||||||
|
|
||||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
|
|
||||||
mesh = SubResource("BoxMesh_b7em5")
|
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
|
|
||||||
shape = SubResource("BoxShape3D_b7em5")
|
|
||||||
|
|
||||||
[node name="Camera3D" type="Camera3D" parent="."]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, 0.91567, 0.401932, 0, -0.401932, 0.91567, 0, 1.85306, 1.55387)
|
|
||||||
current = true
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
class_name PlayerController
|
|
||||||
extends CharacterBody3D
|
|
||||||
|
|
||||||
@export_group("Movement")
|
|
||||||
@export var max_speed : float = 4.0
|
|
||||||
@export var acceleration : float = 20.0
|
|
||||||
@export var braking : float = 20.0
|
|
||||||
@export var air_acceleration : float = 4.0
|
|
||||||
@export var jump_force : float = 5.0
|
|
||||||
@export var gravity_modifier : float = 1.5
|
|
||||||
@export var max_turbo_speed : float = 6.0
|
|
||||||
var is_turboing : bool = false
|
|
||||||
|
|
||||||
@export_group("Camera")
|
|
||||||
@export var look_sensitivity : float = 0.005
|
|
||||||
var camera_look_input : Vector2
|
|
||||||
|
|
||||||
@onready var camera : Camera3D = get_node("Camera3D")
|
|
||||||
@onready var gravity : float = ProjectSettings.get_setting("physics/3d/default_gravity") * gravity_modifier
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
# Lock the mouse
|
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
|
||||||
# Apply gravity
|
|
||||||
if not is_on_floor():
|
|
||||||
velocity.y -= gravity * delta
|
|
||||||
|
|
||||||
# Jumping
|
|
||||||
if Input.is_action_pressed("move_up") and is_on_floor():
|
|
||||||
velocity.y = jump_force
|
|
||||||
|
|
||||||
# Movement
|
|
||||||
var move_input = Input.get_vector("move_left", "move_right", "move_forward", "move_backward")
|
|
||||||
var move_dir = (transform.basis * Vector3(move_input.x, 0, move_input.y)).normalized()
|
|
||||||
|
|
||||||
is_turboing = Input.is_action_pressed("turbo")
|
|
||||||
|
|
||||||
var target_speed = max_speed
|
|
||||||
|
|
||||||
if is_turboing:
|
|
||||||
target_speed = max_turbo_speed
|
|
||||||
var run_dot = -move_dir.dot(transform.basis.z)
|
|
||||||
run_dot = clamp(run_dot, 0.0, 1.0)
|
|
||||||
move_dir *= run_dot
|
|
||||||
|
|
||||||
var current_smoothing = acceleration
|
|
||||||
|
|
||||||
if not is_on_floor():
|
|
||||||
current_smoothing = air_acceleration
|
|
||||||
elif not move_dir:
|
|
||||||
current_smoothing = braking
|
|
||||||
|
|
||||||
var target_vel = move_dir * target_speed
|
|
||||||
|
|
||||||
velocity.x = lerp(velocity.x, target_vel.x, current_smoothing * delta)
|
|
||||||
velocity.z = lerp(velocity.z, target_vel.z, current_smoothing * delta)
|
|
||||||
|
|
||||||
move_and_slide()
|
|
||||||
|
|
||||||
# Camera Look
|
|
||||||
rotate_y(-camera_look_input.x * look_sensitivity)
|
|
||||||
camera.rotate_x(-camera_look_input.y * look_sensitivity)
|
|
||||||
camera.rotation.x = clamp(camera.rotation.x, -1.5, 1.5)
|
|
||||||
camera_look_input = Vector2.ZERO
|
|
||||||
|
|
||||||
# Mouse
|
|
||||||
if Input.is_action_just_pressed("ui_cancel"):
|
|
||||||
if Input.mouse_mode == Input.MOUSE_MODE_VISIBLE:
|
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
|
||||||
else:
|
|
||||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
|
||||||
|
|
||||||
func _unhandled_input(event):
|
|
||||||
if event is InputEventMouseMotion:
|
|
||||||
camera_look_input = event.relative
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://bjpyemep3etrk
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=13 format=3 uid="uid://djlfte5nx8sel"]
|
[gd_scene load_steps=13 format=3 uid="uid://b0dle2c5y4e2q"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dnra1buk328d" path="res://objects/vehicle.tscn" id="2_2d4ji"]
|
[ext_resource type="PackedScene" uid="uid://dnra1buk328d" path="res://objects/vehicle.tscn" id="2_2d4ji"]
|
||||||
[ext_resource type="PackedScene" uid="uid://27u3tdc5yqnl" path="res://objects/ball.tscn" id="2_mv342"]
|
[ext_resource type="PackedScene" uid="uid://27u3tdc5yqnl" path="res://objects/ball.tscn" id="2_mv342"]
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
extends Camera3D
|
|
||||||
|
|
||||||
@export var vehicle: RigidBody3D
|
|
||||||
@export var ball: RigidBody3D
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
|
||||||
if vehicle and ball:
|
|
||||||
# Adjust the offset based on your scene scale
|
|
||||||
# Increasing Y component to raise the camera higher above the vehicle
|
|
||||||
var offset = Vector3(0, 2, -2) # Adjust Y to change height
|
|
||||||
|
|
||||||
# Position the camera behind and above the vehicle
|
|
||||||
var behind_vehicle = vehicle.global_transform.origin - vehicle.global_transform.basis.z * offset.z
|
|
||||||
behind_vehicle += vehicle.global_transform.basis.y * offset.y
|
|
||||||
|
|
||||||
global_transform.origin = behind_vehicle
|
|
||||||
|
|
||||||
look_at(ball.global_transform.origin, Vector3.UP)
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
extends 'res://scripts/Vehicle.gd'
|
|
||||||
|
|
||||||
func get_input_vector() -> Vector3:
|
|
||||||
var input_vector = Vector3.ZERO
|
|
||||||
var camera_path = "/root/MatchNode3D/Players/GridContainer/SubViewportContainer/SubViewport/Player1/Camera3D"
|
|
||||||
var camera = get_node(camera_path)
|
|
||||||
|
|
||||||
if camera:
|
|
||||||
var camera_transform = camera.global_transform
|
|
||||||
var forward_direction = -camera_transform.basis.z
|
|
||||||
var right_direction = camera_transform.basis.x
|
|
||||||
var y_movement = input_vector.y
|
|
||||||
|
|
||||||
if Input.is_action_pressed("move_forward"):
|
|
||||||
input_vector += forward_direction
|
|
||||||
if Input.is_action_pressed("move_backward"):
|
|
||||||
input_vector -= forward_direction
|
|
||||||
if Input.is_action_pressed("move_left"):
|
|
||||||
input_vector -= right_direction
|
|
||||||
if Input.is_action_pressed("move_right"):
|
|
||||||
input_vector += right_direction
|
|
||||||
|
|
||||||
# Zero out the Y component to restrict movement to the XZ plane
|
|
||||||
input_vector.y = 0
|
|
||||||
|
|
||||||
# Add back the preserved Y movement
|
|
||||||
input_vector.y = y_movement
|
|
||||||
|
|
||||||
if Input.is_action_pressed("move_up"):
|
|
||||||
input_vector.y += 1
|
|
||||||
if Input.is_action_pressed("move_down"):
|
|
||||||
input_vector.y -= 1
|
|
||||||
|
|
||||||
return input_vector.normalized()
|
|
||||||
else:
|
|
||||||
print("Camera not found")
|
|
||||||
return Vector3.ZERO
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
extends 'res://scripts/Vehicle.gd'
|
|
||||||
|
|
||||||
func get_input_vector() -> Vector3:
|
|
||||||
var input_vector = Vector3.ZERO
|
|
||||||
var camera_path = "/root/MatchNode3D/Players/GridContainer/SubViewportContainer/SubViewport/Player1/Camera3D"
|
|
||||||
var camera = get_node(camera_path)
|
|
||||||
|
|
||||||
if camera:
|
|
||||||
var camera_transform = camera.global_transform
|
|
||||||
var forward_direction = -camera_transform.basis.z
|
|
||||||
var right_direction = camera_transform.basis.x
|
|
||||||
var y_movement = input_vector.y
|
|
||||||
|
|
||||||
if Input.is_action_pressed("move_forward2"):
|
|
||||||
input_vector += forward_direction
|
|
||||||
if Input.is_action_pressed("move_backward2"):
|
|
||||||
input_vector -= forward_direction
|
|
||||||
if Input.is_action_pressed("move_left2"):
|
|
||||||
input_vector -= right_direction
|
|
||||||
if Input.is_action_pressed("move_right2"):
|
|
||||||
input_vector += right_direction
|
|
||||||
|
|
||||||
# Zero out the Y component to restrict movement to the XZ plane
|
|
||||||
input_vector.y = 0
|
|
||||||
|
|
||||||
# Add back the preserved Y movement
|
|
||||||
input_vector.y = y_movement
|
|
||||||
|
|
||||||
if Input.is_action_pressed("move_up2"):
|
|
||||||
input_vector.y += 1
|
|
||||||
if Input.is_action_pressed("move_down2"):
|
|
||||||
input_vector.y -= 1
|
|
||||||
|
|
||||||
return input_vector.normalized()
|
|
||||||
else:
|
|
||||||
print("Camera not found")
|
|
||||||
return Vector3.ZERO
|
|
||||||
Reference in New Issue
Block a user