first commit
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*.png
|
||||
/.import
|
||||
BIN
art/fonts/Pixelmania.ttf
Normal file
BIN
art/fonts/Pixelmania.ttf
Normal file
Binary file not shown.
BIN
art/fonts/ThisGameFont.res
Normal file
BIN
art/fonts/ThisGameFont.res
Normal file
Binary file not shown.
34
art/wall.png.import
Normal file
34
art/wall.png.import
Normal file
@@ -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
|
||||
7
default_env.tres
Normal file
7
default_env.tres
Normal file
@@ -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 )
|
||||
34
icon.png.import
Normal file
34
icon.png.import
Normal 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
|
||||
42
project.godot
Normal file
42
project.godot
Normal file
@@ -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"
|
||||
27
src/main.gd
Normal file
27
src/main.gd
Normal file
@@ -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)
|
||||
39
src/main.tscn
Normal file
39
src/main.tscn
Normal file
@@ -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"]
|
||||
7
src/players/player.gd
Normal file
7
src/players/player.gd
Normal file
@@ -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)
|
||||
18
src/players/player.tscn
Normal file
18
src/players/player.tscn
Normal file
@@ -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 )
|
||||
18
src/walls/wall.tscn
Normal file
18
src/walls/wall.tscn
Normal file
@@ -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 )
|
||||
Reference in New Issue
Block a user