From 4affe81133cd03e5b3b78dab6b83d32f6d889a40 Mon Sep 17 00:00:00 2001 From: Wolf Moyaers Date: Thu, 19 Mar 2020 21:28:29 +0100 Subject: [PATCH] first commit --- .gitignore | 2 ++ art/fonts/Pixelmania.ttf | Bin 0 -> 6844 bytes art/fonts/ThisGameFont.res | Bin 0 -> 289 bytes art/wall.png.import | 34 ++++++++++++++++++++++++++++++ default_env.tres | 7 +++++++ icon.png.import | 34 ++++++++++++++++++++++++++++++ project.godot | 42 +++++++++++++++++++++++++++++++++++++ src/main.gd | 27 ++++++++++++++++++++++++ src/main.tscn | 39 ++++++++++++++++++++++++++++++++++ src/players/player.gd | 7 +++++++ src/players/player.tscn | 18 ++++++++++++++++ src/walls/wall.tscn | 18 ++++++++++++++++ 12 files changed, 228 insertions(+) create mode 100644 .gitignore create mode 100644 art/fonts/Pixelmania.ttf create mode 100644 art/fonts/ThisGameFont.res create mode 100644 art/wall.png.import create mode 100644 default_env.tres create mode 100644 icon.png.import create mode 100644 project.godot create mode 100644 src/main.gd create mode 100644 src/main.tscn create mode 100644 src/players/player.gd create mode 100644 src/players/player.tscn create mode 100644 src/walls/wall.tscn diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..22a7d57 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.png +/.import \ No newline at end of file diff --git a/art/fonts/Pixelmania.ttf b/art/fonts/Pixelmania.ttf new file mode 100644 index 0000000000000000000000000000000000000000..0c20d6a4d4e48857343ae1506d11327aa629e246 GIT binary patch literal 6844 zcmds6Z)_CD6`z^i+q=E9V_!JOF{I5I^0&dnJ{xSuIV&;wb4ZZTq#}?~hy`cI)W()= z5XFr!YK>G9g`|lPjr;+=kT$BSh#FL-q$(S$7*sb4tG13Hugcy}JxnitV= z`})8ukf-DMt`|Fc_kH>XT8tmZpLg3kcQkM7-SRbK`tR`kd`I)XE>_DP!~6U29NpdA zkz5n{xP-CNUd%t-)!EZ4wrcNV{yMzh-_@P$8sf79`2Hh2>x^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3gAuF*aDx3A;V}iu^j~sa728=hvBcHzN!45U;T34r-}tB zM4Kiaunr?lP|qSSun9u8OV*_vJqG;@&mK}`KyG~!A*@aP*3`^Vm`6K6ZAk1ljm(wl z3#b@lY9ly((TItDW$y|2xmeaRiX&w{$qE^*d|ZLCLW;%h)I}Auv`3Zvn5S`gpEj$i zBER`EwfuXgM~zzVTvUsD=UP$X;brfP$~3CPJ#%+mP{9kHrukLa!qdbp=df{8>xo3Q zU8*9(4cij6Hz19(2`E-$O6rt8KT-HLFeq~OC=RR0=@;rl-K3AU7EFhIwnZx%1)Z$w zvH5Vg1q_p4+b9&>dV>lwI~6#U2@$b56t47;z9_}nRvsS(LhkS4`s7|aaY-i$!q6+o z0hAY1l+aWTWE56vlY|B50P!Gcf;t%y2U?{43vYBw8TwAIfHb+;fa=&yS_Ak%nt^R^ zlS8Q~5wOpbN2Dz$VM}CwT)D`4t#Ey7rMvQB+lL(9FXKwCfzw;8N&7i#QX4YfrmY^8 z2H1~MK~6cL=30`gPxJ8vu9_RgE>g&o?TBO%veM}jAS^3QJ_PX-HhJndBeaVfp~aGt zb42A2Abb47UF1ZbC%yn!~aaOs{X>**U z{n=>?oNvDBv^Cbw2A#I<8RKJ{dBEv6JpCps;4e7+1uV+jopvFs;jgUgXl_mJi^eLe z>Yhoq?rCrCu3lBOs;auK;n}KKZB1pYeod^ZA+f%pvbwgmCRWq1v29*gDq1nprDL!rmy0u}a`w$DYA+E87DLn^`x`5mup>u4=q%V9%lz!~aXvU~~+p z)obv#3jGPT9)Bw_s#d;@VMGJl$l4$~30XALZag)!hu9|cbh92jb)qjS;lTo5$t~)*?0N#i&(m z2ihI%3HfajGU#15?p=x8>D7_K`t~G2m(5{6S>VaVcdl<|~@eIlM-vaS(5yRit literal 0 HcmV?d00001 diff --git a/art/fonts/ThisGameFont.res b/art/fonts/ThisGameFont.res new file mode 100644 index 0000000000000000000000000000000000000000..8c6a2a0a9f78e7db772f009f548ff80b0879a691 GIT binary patch literal 289 zcmV++0p9*nQ$s@n000005C8xN0ssIB0RR9fwJ-f(2Lb&D0J6?4DS%5z0MGM0&$E^D z@6-K0rQOJOzZ35!5uc5+-XyUb0MwX-vMDnVDSHu>ipsy_86c02U%E*$oOtSD;n3_( zP&H&LH53K&n03f75Dk=r|M5D?C4nE9jD(i8u))O(v`w3T;8fV*B_+&sS1k)Wx(K7G zgw8|gRwI9eUG7p1!OubFD2DPqPM4+#%BI#n`Wu`a>iq#H!dGvql(bIyFm{n!%LY?Y literal 0 HcmV?d00001 diff --git a/art/wall.png.import b/art/wall.png.import new file mode 100644 index 0000000..6105b48 --- /dev/null +++ b/art/wall.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/wall.png-a390048f5e12dd0b271d636d681186c9.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/wall.png" +dest_files=[ "res://.import/wall.png-a390048f5e12dd0b271d636d681186c9.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 diff --git a/default_env.tres b/default_env.tres new file mode 100644 index 0000000..20207a4 --- /dev/null +++ b/default_env.tres @@ -0,0 +1,7 @@ +[gd_resource type="Environment" load_steps=2 format=2] + +[sub_resource type="ProceduralSky" id=1] + +[resource] +background_mode = 2 +background_sky = SubResource( 1 ) diff --git a/icon.png.import b/icon.png.import new file mode 100644 index 0000000..96cbf46 --- /dev/null +++ b/icon.png.import @@ -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 diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..ffd6eba --- /dev/null +++ b/project.godot @@ -0,0 +1,42 @@ +; 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 + +_global_script_classes=[ ] +_global_script_class_icons={ + +} + +[application] + +config/name="N-pong" +config/icon="res://icon.png" + +[display] + +window/size/width=1920 +window/size/height=1080 + +[input] + +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) + ] +} +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) + ] +} + +[rendering] + +environment/default_clear_color=Color( 0, 0, 0, 1 ) +environment/default_environment="res://default_env.tres" diff --git a/src/main.gd b/src/main.gd new file mode 100644 index 0000000..86d4a1d --- /dev/null +++ b/src/main.gd @@ -0,0 +1,27 @@ +extends Node2D +var AmountOfPlayers +var AoP +var scene = load("res://src/walls/wall.tscn") +var player = load("res://src/players/player.tscn") +func _on_TextEdit_text_entered(new_text): + AmountOfPlayers = new_text + $TextEdit.queue_free() + $Label.queue_free() + AoP = AmountOfPlayers.to_int() + for i in range(0,AoP*2,2): + var scene_instance = scene.instance() + var sprite = scene_instance.get_node("Sprite") + sprite.set_scale(Vector2((430/sin((PI-(2*PI/(AoP*2)))/2))*sin(((2*PI)/(2*AoP))/2)*2/32,1)) + scene_instance.set_name("wall") + + add_child(scene_instance) + scene_instance.set_position(Vector2(960,540)) + scene_instance.set_rotation((PI/AoP)*i) + for i in range(1,AoP*2,2): + var player_instance = player.instance() + var sprite2 = player_instance.get_node("Sprite") + sprite2.set_scale(Vector2((430/sin((PI-(2*PI/(AoP*2)))/2))*sin(((2*PI)/(2*AoP))/2)*2/32/4,1)) + player_instance.set_name("player") + add_child(player_instance) + player_instance.set_position(Vector2(960,540)) + player_instance.set_rotation((PI/AoP)*i) diff --git a/src/main.tscn b/src/main.tscn new file mode 100644 index 0000000..92da025 --- /dev/null +++ b/src/main.tscn @@ -0,0 +1,39 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://art/fonts/ThisGameFont.res" type="DynamicFont" id=1] +[ext_resource path="res://src/main.gd" type="Script" id=2] + +[sub_resource type="Theme" id=1] + +[sub_resource type="StyleBoxFlat" id=2] +bg_color = Color( 0.0117647, 0, 0.286275, 0.431373 ) + +[node name="main" type="Node2D"] +script = ExtResource( 2 ) + +[node name="TextEdit" type="LineEdit" parent="."] +margin_left = 899.468 +margin_top = 491.618 +margin_right = 1037.47 +margin_bottom = 564.618 +theme = SubResource( 1 ) +custom_styles/normal = SubResource( 2 ) +custom_fonts/font = ExtResource( 1 ) +max_length = 3 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="."] +margin_left = 853.0 +margin_top = 389.0 +margin_right = 1088.0 +margin_bottom = 493.0 +custom_fonts/font = ExtResource( 1 ) +text = "PLAYER +AMOUNT" +autowrap = true +__meta__ = { +"_edit_use_anchors_": false +} +[connection signal="text_entered" from="TextEdit" to="." method="_on_TextEdit_text_entered"] diff --git a/src/players/player.gd b/src/players/player.gd new file mode 100644 index 0000000..9026d20 --- /dev/null +++ b/src/players/player.gd @@ -0,0 +1,7 @@ +extends KinematicBody2D +export var speed = 800 +var velocity: = Vector2() +func _physics_process(delta): + velocity = Vector2(0,Input.get_action_strength("move_down")-Input.get_action_strength("move_up")) + velocity = velocity *speed + move_and_slide(velocity) diff --git a/src/players/player.tscn b/src/players/player.tscn new file mode 100644 index 0000000..05319f6 --- /dev/null +++ b/src/players/player.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://art/wall.png" type="Texture" id=1] +[ext_resource path="res://src/players/player.gd" type="Script" id=2] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 16, 16 ) + +[node name="KinematicBody2D" type="KinematicBody2D"] +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +position = Vector2( 0, 446 ) +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2( 0, 446 ) +shape = SubResource( 1 ) diff --git a/src/walls/wall.tscn b/src/walls/wall.tscn new file mode 100644 index 0000000..3199d74 --- /dev/null +++ b/src/walls/wall.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://art/wall.png" type="Texture" id=1] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 16, 16 ) + +[node name="wall" type="StaticBody2D"] + +[node name="Sprite" type="Sprite" parent="."] +position = Vector2( 0, 446 ) +texture = ExtResource( 1 ) +region_enabled = true +region_rect = Rect2( 0, 0, 32, 32 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2( 0, 446 ) +shape = SubResource( 1 )