Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions GrappleZone.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extends Area2D


# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.

func _on_body_entered(body):
if body.has_method("when_stuck"):
body.when_stuck()

func _on_body_exited(body):
if body.has_method("when_stuck"):
body.stuck = false
39 changes: 39 additions & 0 deletions Hook.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
extends RigidBody2D

var casted : bool = false
var submerged : bool = false
var stuck : bool = false

const AIR_RESISTANCE = 7.0
const WATER_RESISTANCE = 90.0

# 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 _physics_process(_delta):
if stuck && linear_velocity.x != 0:
syncStuck()
if casted && submerged:
when_submerged()
elif casted && !submerged:
linear_velocity.x = move_toward(linear_velocity.x, 0, AIR_RESISTANCE)

func when_submerged():
angular_velocity = move_toward(angular_velocity, 0.5, 1.5)
linear_velocity.x = move_toward(linear_velocity.x, 0, WATER_RESISTANCE)
linear_velocity.y = move_toward(linear_velocity.y, 25, WATER_RESISTANCE)

func when_stuck():
stuck = true

@rpc("any_peer", "call_local")
func syncStuck() -> void:
linear_velocity.x = 0
linear_velocity.y = 0
angular_velocity = 0
gravity_scale = 0
Binary file added Idle (32x32).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Idle (32x32).png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dpoayxj2o7yos"
path="res://.godot/imported/Idle (32x32).png-eab6f8bc6cc3e2ad30a389b322c823ee.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Idle (32x32).png"
dest_files=["res://.godot/imported/Idle (32x32).png-eab6f8bc6cc3e2ad30a389b322c823ee.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
Binary file added InvasionGame/Assets/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions InvasionGame/Assets/background.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bg0jm8d1nr1fe"
path="res://.godot/imported/background.png-43d745a6ca23b706381eec07eead4b7d.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://InvasionGame/Assets/background.png"
dest_files=["res://.godot/imported/background.png-43d745a6ca23b706381eec07eead4b7d.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
Binary file added InvasionGame/Assets/shadow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions InvasionGame/Assets/shadow.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bvthcsg02y8e7"
path="res://.godot/imported/shadow.png-f773d23f134ae05fd059bbf548efc1ac.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://InvasionGame/Assets/shadow.png"
dest_files=["res://.godot/imported/shadow.png-f773d23f134ae05fd059bbf548efc1ac.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
Binary file added InvasionGame/Assets/temp_body.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions InvasionGame/Assets/temp_body.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://b7njr7mty1l3m"
path="res://.godot/imported/temp_body.png-b4f7932ffce4889f1260ed17644bb562.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://InvasionGame/Assets/temp_body.png"
dest_files=["res://.godot/imported/temp_body.png-b4f7932ffce4889f1260ed17644bb562.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
25 changes: 25 additions & 0 deletions InvasionGame/Scenes/gnome.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[gd_scene load_steps=5 format=3 uid="uid://bdqm21wnq55fr"]

[ext_resource type="Texture2D" uid="uid://b7njr7mty1l3m" path="res://InvasionGame/Assets/temp_body.png" id="1_8lr4i"]
[ext_resource type="Texture2D" uid="uid://bvthcsg02y8e7" path="res://InvasionGame/Assets/shadow.png" id="1_iewdx"]
[ext_resource type="Script" path="res://InvasionGame/Scripts/gnome.gd" id="1_nr5yv"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_00gno"]
size = Vector2(60, 80)

[node name="Gnome" type="CharacterBody2D"]
script = ExtResource("1_nr5yv")

[node name="ShadowSprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_iewdx")

[node name="GnomeSprite2D" type="Sprite2D" parent="."]
position = Vector2(0, -40)
texture = ExtResource("1_8lr4i")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -40)
shape = SubResource("RectangleShape2D_00gno")

[node name="Camera2D" type="Camera2D" parent="."]
zoom = Vector2(0.59, 0.59)
17 changes: 17 additions & 0 deletions InvasionGame/Scenes/invasion_world.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[gd_scene load_steps=2 format=3 uid="uid://dltuaf2shbn46"]

[ext_resource type="Texture2D" uid="uid://bg0jm8d1nr1fe" path="res://InvasionGame/Assets/background.png" id="1_ss0j8"]

[node name="World" type="Node2D"]

[node name="Background" type="Sprite2D" parent="."]
modulate = Color(0.446777, 0.446777, 0.446777, 1)
texture = ExtResource("1_ss0j8")

[node name="Players" type="Node2D" parent="."]

[node name="SpawnPoint" type="Node2D" parent="."]

[node name="PlayerSpawner" type="MultiplayerSpawner" parent="."]
_spawnable_scenes = PackedStringArray("res://InvasionGame/Scenes/gnome.tscn")
spawn_path = NodePath("../Players")
39 changes: 39 additions & 0 deletions InvasionGame/Scripts/gnome.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
extends CharacterBody2D


const SPEED = 300.0
const JUMP_VELOCITY = -400.0

# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")

@rpc("any_peer", "call_local")
func set_authority(id : int) -> void:
set_multiplayer_authority(id)

func _physics_process(delta):
# Add the gravity.
#if not is_on_floor():
#velocity.y += gravity * delta

# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY

# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction = Input.get_axis("ui_left", "ui_right")
if direction:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)

move_and_slide()

func set_player_name(value : String):
#$label.text = value
return

@rpc("any_peer", "call_local")
func teleport(new_position : Vector2) -> void:
self.position = new_position
15 changes: 15 additions & 0 deletions Killzone.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
extends Area2D


# Called when the node enters the scene tree for the first time.
func _ready():
set_collision_mask_value(2, true)


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
pass

func _on_body_entered(body):
body.position.x = 565
body.position.y = 475
16 changes: 16 additions & 0 deletions OneWayPlats.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extends Area2D


# Called when the node enters the scene tree for the first time.
func _ready():
set_collision_mask_value(2, true)

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
pass

func _on_body_entered(body):
body.canFall = true

func _on_body_exited(body):
body.canFall = false
20 changes: 20 additions & 0 deletions WaterArea2D.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
extends Area2D


# 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_body_entered(body):
if body.has_method("when_submerged"):
body.submerged = true
body.linear_velocity.y *= 0.9

func _on_body_exited(body):
if body.has_method("when_submerged"):
body.submerged = false
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading