Initial commit

This commit is contained in:
Kristofers Solo
2021-10-04 19:03:30 +03:00
commit 9932727c92
157 changed files with 15086 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
source_md5="9750ca6557519b87fc4520d712122db2"
dest_md5="5eb6e761bb9e4397cd2a5caa6c18dc5a"

View File

@@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="2ded9e7f9060e2b530aab678b135fc5b"

View File

@@ -0,0 +1,3 @@
source_md5="955d690ad235d803af1ea20b98c6c3dc"
dest_md5="92a6f5c5b2f6296b05cab30ce1278e0e"

View File

@@ -0,0 +1,3 @@
source_md5="4f501708bd37bf4cbdd218c104ac8ae5"
dest_md5="d6c6d4987c8841435ace13715a0c1bd8"

View File

@@ -0,0 +1,3 @@
source_md5="4c808b578f2c91daff0d263d354987bc"
dest_md5="891b486e29729d74d35394bfcab59da4"

BIN
Game #3/Roboto-Regular.ttf Normal file

Binary file not shown.

BIN
Game #3/Sprites/floor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/floor.png-bad02a3061f4734a68e01c2ddec9b22e.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/floor.png"
dest_files=[ "res://.import/floor.png-bad02a3061f4734a68e01c2ddec9b22e.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/jedi.png-f9be092cc27114ea04f99ed2335d3100.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/jedi.png"
dest_files=[ "res://.import/jedi.png-f9be092cc27114ea04f99ed2335d3100.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/lava.png-68ab43619d46c5f3cf0fd86b7248d922.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/lava.png"
dest_files=[ "res://.import/lava.png-68ab43619d46c5f3cf0fd86b7248d922.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
Game #3/Sprites/sphere.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/sphere.png-b7490a5e3cfc87a7a150d30e23b12756.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/sphere.png"
dest_files=[ "res://.import/sphere.png-b7490a5e3cfc87a7a150d30e23b12756.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
Game #3/Sprites/sphere.png~ Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,24 @@
[preset.0]
name="Linux/X11"
platform="Linux/X11"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="Builds/game.x86_64"
script_export_mode=1
script_encryption_key=""
[preset.0.options]
custom_template/debug=""
custom_template/release=""
binary_format/64_bits=true
binary_format/embed_pck=true
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true

14
Game #3/floor.tscn Normal file
View File

@@ -0,0 +1,14 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Sprites/floor.png" type="Texture" id=1]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 960.259, 24.9333 )
[node name="StaticBody2D" type="StaticBody2D"]
[node name="floor" type="Sprite" parent="."]
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )

17
Game #3/game.gd Normal file
View File

@@ -0,0 +1,17 @@
extends Node2D
onready var player_pos_1 = $PostitionPlayer_1
onready var player_pos_2 = $PostitionPlayer_2
func _ready():
var player_1 = preload("res://player.tscn").instance()
player_1.set_name(str(get_tree().get_network_unique_id()))
player_1.set_network_master(get_tree().get_network_unique_id())
player_1.global_transform = player_pos_1.global_transform
add_child(player_1)
var player_2 = preload("res://player.tscn").instance()
player_2.set_name(str(Singleton.user_id))
player_2.set_network_master(Singleton.user_id)
player_2.global_transform = player_pos_2.global_transform
add_child(player_2)

18
Game #3/game.tscn Normal file
View File

@@ -0,0 +1,18 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://game.gd" type="Script" id=1]
[ext_resource path="res://floor.tscn" type="PackedScene" id=4]
[node name="game" type="Node2D"]
position = Vector2( -16, 0 )
script = ExtResource( 1 )
[node name="floor" parent="." instance=ExtResource( 4 )]
position = Vector2( 958.693, 1053.79 )
scale = Vector2( 2, 1 )
[node name="PostitionPlayer_1" type="Position2D" parent="."]
position = Vector2( 432.3, 341.745 )
[node name="PostitionPlayer_2" type="Position2D" parent="."]
position = Vector2( 1440.24, 361.904 )

BIN
Game #3/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

34
Game #3/icon.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

30
Game #3/menu.gd Normal file
View File

@@ -0,0 +1,30 @@
extends Node2D
func _ready():
get_tree().connect("network_peer_connected", self, "_connected")
func _on_singleplayer_pressed():
var game = preload("res://game.tscn").instance()
get_tree().get_root().add_child(game)
hide()
func _on_join_button_pressed():
var client = NetworkedMultiplayerENet.new()
client.create_client("127.0.0.1", 8080)
get_tree().set_network_peer(client)
func _on_host_button_pressed():
var server = NetworkedMultiplayerENet.new()
server.create_server(8080, 2)
get_tree().set_network_peer(server)
func _connected(client_id):
Singleton.user_id = client_id
var game = preload("res://game.tscn").instance()
get_tree().get_root().add_child(game)
hide()

57
Game #3/menu.tscn Normal file
View File

@@ -0,0 +1,57 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://roboto.tres" type="DynamicFont" id=1]
[ext_resource path="res://menu.gd" type="Script" id=2]
[node name="menu" type="Node2D"]
position = Vector2( 984, 560 )
script = ExtResource( 2 )
[node name="singleplayer" type="Button" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -144.0
margin_top = -200.0
margin_right = 156.0
margin_bottom = -120.0
custom_fonts/font = ExtResource( 1 )
text = "Singleplayer"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="host_button" type="Button" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -150.0
margin_top = -90.0
margin_right = 150.0
margin_bottom = -10.0001
custom_fonts/font = ExtResource( 1 )
text = "Host game"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="join_button" type="Button" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -150.0
margin_top = 10.0
margin_right = 150.0
margin_bottom = 90.0
custom_fonts/font = ExtResource( 1 )
text = "Join game"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="singleplayer" to="." method="_on_singleplayer_pressed"]
[connection signal="pressed" from="host_button" to="." method="_on_host_button_pressed"]
[connection signal="pressed" from="join_button" to="." method="_on_join_button_pressed"]

80
Game #3/player.gd Normal file
View File

@@ -0,0 +1,80 @@
extends KinematicBody2D
const JUMP_FORCE = 500
const GRAVITY = 700
const MAX_SPEED = 10000
var speed = 15
var velocity = Vector2()
var fly = false
func _ready():
pass
remote func _set_pos(position):
global_transform.origin = position
func _physics_process(delta):
if is_network_master():
mode_switch(delta)
screen_wrap()
rpc_unreliable("_set_pos", global_transform.origin)
func mode_switch(delta):
if Input.is_action_just_pressed("mode_switch") and fly == false:
fly = true
elif Input.is_action_just_pressed("mode_switch") and fly == true:
fly = false
if fly == false:
movement(delta)
elif fly == true:
flying()
func movement(delta):
if Input.is_action_just_pressed("stop"):
velocity.x = 0
velocity.y = 0
if Input.is_action_pressed("move_left"):
if velocity.x > -MAX_SPEED:
velocity.x -= speed
elif Input.is_action_pressed("move_right"):
if velocity.x < MAX_SPEED:
velocity.x += speed
#if !Input.is_action_pressed("move_left") and !Input.is_action_pressed("move_right") and is_on_floor():
# velocity.x = 0
velocity.y += GRAVITY * delta
if Input.is_action_pressed("jump") and is_on_floor():
velocity.y -= JUMP_FORCE
velocity = move_and_slide(velocity, Vector2.UP)
func flying():
speed = 500
var velocity = Vector2()
if Input.is_action_pressed("move_right"):
velocity.x += 1
if Input.is_action_pressed("move_left"):
velocity.x -= 1
if Input.is_action_pressed("move_down"):
velocity.y += 1
if Input.is_action_pressed("move_up"):
velocity.y -= 1
velocity = velocity.normalized() * speed
velocity = move_and_slide(velocity)
func screen_wrap():
if position.x <= -10:
position.x = get_viewport_rect().size.x
if position.x >= get_viewport_rect().size.x + 10:
position.x = 0

23
Game #3/player.tscn Normal file
View File

@@ -0,0 +1,23 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Sprites/sphere.png" type="Texture" id=1]
[ext_resource path="res://player.gd" type="Script" id=2]
[sub_resource type="CanvasItemMaterial" id=1]
[sub_resource type="CircleShape2D" id=2]
radius = 22.8565
[node name="player" type="KinematicBody2D"]
script = ExtResource( 2 )
[node name="sphere" type="Sprite" parent="."]
scale = Vector2( 0.5, 0.5 )
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
modulate = Color( 1, 0, 0, 1 )
self_modulate = Color( 1, 0, 0, 1 )
light_mask = 0
material = SubResource( 1 )
shape = SubResource( 2 )

74
Game #3/project.godot Normal file
View File

@@ -0,0 +1,74 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
[application]
config/name="Game #3"
run/main_scene="res://menu.tscn"
config/icon="res://icon.png"
[autoload]
Singleton="*res://singleton.gd"
[debug]
settings/stdout/print_fps=true
[display]
window/size/width=1920
window/size/height=1080
window/size/test_width=1024
window/size/test_height=600
window/stretch/mode="2d"
window/stretch/aspect="keep"
[input]
move_left={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null)
]
}
move_right={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null)
]
}
jump={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
]
}
move_down={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
]
}
stop={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777237,"unicode":0,"echo":false,"script":null)
]
}
mode_switch={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":77,"unicode":0,"echo":false,"script":null)
]
}
move_up={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
]
}
[physics]
common/enable_pause_aware_picking=true

9
Game #3/roboto.tres Normal file
View File

@@ -0,0 +1,9 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://Roboto-Regular.ttf" type="DynamicFontData" id=1]
[resource]
size = 32
use_mipmaps = true
use_filter = true
font_data = ExtResource( 1 )

7
Game #3/roboto2.tres Normal file
View File

@@ -0,0 +1,7 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://Roboto-Regular.ttf" type="DynamicFontData" id=1]
[resource]
size = 25
font_data = ExtResource( 1 )

6
Game #3/singleton.gd Normal file
View File

@@ -0,0 +1,6 @@
extends Node
var user_id = -1
func _ready():
pass