commit 4affe81133cd03e5b3b78dab6b83d32f6d889a40 Author: Wolf Moyaers Date: Thu Mar 19 21:28:29 2020 +0100 first commit 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 0000000..0c20d6a Binary files /dev/null and b/art/fonts/Pixelmania.ttf differ diff --git a/art/fonts/ThisGameFont.res b/art/fonts/ThisGameFont.res new file mode 100644 index 0000000..8c6a2a0 Binary files /dev/null and b/art/fonts/ThisGameFont.res differ 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 )