First commit
This commit is contained in:
commit
5c46c7e3a7
4
.editorconfig
Normal file
4
.editorconfig
Normal file
|
@ -0,0 +1,4 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Normalize EOL for all files that Git considers text files.
|
||||
* text=auto eol=lf
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
/android/
|
BIN
etc/Typodermic Desktop EULA 2023.pdf
Normal file
BIN
etc/Typodermic Desktop EULA 2023.pdf
Normal file
Binary file not shown.
BIN
etc/bulletinV1.ttf
Normal file
BIN
etc/bulletinV1.ttf
Normal file
Binary file not shown.
35
etc/bulletinV1.ttf.import
Normal file
35
etc/bulletinV1.ttf.import
Normal file
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://dxcsr8pfoj3c"
|
||||
path="res://.godot/imported/bulletinV1.ttf-012ce5be515230bcc15efcf69b5d910d.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://etc/bulletinV1.ttf"
|
||||
dest_files=["res://.godot/imported/bulletinV1.ttf-012ce5be515230bcc15efcf69b5d910d.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=4
|
||||
keep_rounding_remainders=true
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
etc/joystix monospace.otf
Normal file
BIN
etc/joystix monospace.otf
Normal file
Binary file not shown.
35
etc/joystix monospace.otf.import
Normal file
35
etc/joystix monospace.otf.import
Normal file
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://bpyvehrtj64w4"
|
||||
path="res://.godot/imported/joystix monospace.otf-b02854d0d16fd2029b5a8967d2302fca.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://etc/joystix monospace.otf"
|
||||
dest_files=["res://.godot/imported/joystix monospace.otf-b02854d0d16fd2029b5a8967d2302fca.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=4
|
||||
keep_rounding_remainders=true
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
etc/pixelated.ttf
Normal file
BIN
etc/pixelated.ttf
Normal file
Binary file not shown.
35
etc/pixelated.ttf.import
Normal file
35
etc/pixelated.ttf.import
Normal file
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://cukc34hue3c0h"
|
||||
path="res://.godot/imported/pixelated.ttf-8108ecaf469dcb17762df1698b1a31d0.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://etc/pixelated.ttf"
|
||||
dest_files=["res://.godot/imported/pixelated.ttf-8108ecaf469dcb17762df1698b1a31d0.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=4
|
||||
keep_rounding_remainders=true
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
etc/slkscr.ttf
Normal file
BIN
etc/slkscr.ttf
Normal file
Binary file not shown.
41
etc/slkscr.ttf.import
Normal file
41
etc/slkscr.ttf.import
Normal file
|
@ -0,0 +1,41 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://dj1hgg8vhug8j"
|
||||
path="res://.godot/imported/slkscr.ttf-a34f04441fa3110ed0cb71386e727660.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://etc/slkscr.ttf"
|
||||
dest_files=["res://.godot/imported/slkscr.ttf-a34f04441fa3110ed0cb71386e727660.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=0
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=0
|
||||
subpixel_positioning=0
|
||||
keep_rounding_remainders=false
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[{
|
||||
"chars": [],
|
||||
"glyphs": [],
|
||||
"name": "New Configuration",
|
||||
"size": Vector2i(16, 0),
|
||||
&"variation_embolden": 0.0
|
||||
}]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
etc/terminal-grotesque_open.otf
Normal file
BIN
etc/terminal-grotesque_open.otf
Normal file
Binary file not shown.
35
etc/terminal-grotesque_open.otf.import
Normal file
35
etc/terminal-grotesque_open.otf.import
Normal file
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://bmnx5fijr0gl7"
|
||||
path="res://.godot/imported/terminal-grotesque_open.otf-51b8af7114f8a494e7b060d9146a3267.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://etc/terminal-grotesque_open.otf"
|
||||
dest_files=["res://.godot/imported/terminal-grotesque_open.otf-51b8af7114f8a494e7b060d9146a3267.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=4
|
||||
keep_rounding_remainders=true
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
1
icon.svg
Normal file
1
icon.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>
|
After Width: | Height: | Size: 994 B |
37
icon.svg.import
Normal file
37
icon.svg.import
Normal file
|
@ -0,0 +1,37 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://0mxbnydfl7u3"
|
||||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.svg"
|
||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
56
project.godot
Normal file
56
project.godot
Normal file
|
@ -0,0 +1,56 @@
|
|||
; 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=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Calculations"
|
||||
run/main_scene="uid://dinanmpmnja1"
|
||||
config/features=PackedStringArray("4.4", "GL Compatibility")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=384
|
||||
window/size/viewport_height=256
|
||||
window/stretch/mode="viewport"
|
||||
|
||||
[input]
|
||||
|
||||
left={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
right={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
up={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
down={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
textures/canvas_textures/default_texture_filter=0
|
||||
renderer/rendering_method="gl_compatibility"
|
||||
renderer/rendering_method.mobile="gl_compatibility"
|
||||
environment/defaults/default_clear_color=Color(0.639216, 0.635294, 0.603922, 1)
|
8
scenes/bullet/bullet.gd
Normal file
8
scenes/bullet/bullet.gd
Normal file
|
@ -0,0 +1,8 @@
|
|||
extends Node2D
|
||||
|
||||
var speed = 100
|
||||
var base_speed = 10
|
||||
var direction = 0
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
position += speed*delta*base_speed*direction
|
1
scenes/bullet/bullet.gd.uid
Normal file
1
scenes/bullet/bullet.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://c6sk0p3b1ilbg
|
17
scenes/bullet/bullet.tscn
Normal file
17
scenes/bullet/bullet.tscn
Normal file
|
@ -0,0 +1,17 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dpdt7rbma7ugn"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c6sk0p3b1ilbg" path="res://scenes/bullet/bullet.gd" id="1_7c8un"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_83itf"]
|
||||
size = Vector2(1, 1)
|
||||
|
||||
[node name="bullet" type="Area2D"]
|
||||
script = ExtResource("1_7c8un")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0.5, 0.5)
|
||||
shape = SubResource("RectangleShape2D_83itf")
|
||||
|
||||
[node name="Polygon2D" type="Polygon2D" parent="."]
|
||||
color = Color(0.772549, 0.411765, 0.505882, 1)
|
||||
polygon = PackedVector2Array(1, 0, 0, 0, 0, 1, 1, 1)
|
BIN
scenes/inventory/WindowPane.png
Normal file
BIN
scenes/inventory/WindowPane.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
34
scenes/inventory/WindowPane.png.import
Normal file
34
scenes/inventory/WindowPane.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://wygld7k1t3ad"
|
||||
path="res://.godot/imported/WindowPane.png-16caec9e087b4d5658a3cceb3821cd10.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://scenes/inventory/WindowPane.png"
|
||||
dest_files=["res://.godot/imported/WindowPane.png-16caec9e087b4d5658a3cceb3821cd10.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
|
BIN
scenes/inventory/WindowPane.pxo
Normal file
BIN
scenes/inventory/WindowPane.pxo
Normal file
Binary file not shown.
15
scenes/inventory/bonus/bonus.gd
Normal file
15
scenes/inventory/bonus/bonus.gd
Normal file
|
@ -0,0 +1,15 @@
|
|||
extends Item
|
||||
|
||||
class_name Bonus
|
||||
|
||||
@export var _bonus : String = "mult"
|
||||
|
||||
func _init():
|
||||
layer = 1
|
||||
|
||||
func set_value(new_value : String):
|
||||
_bonus = new_value
|
||||
|
||||
func calculate_bonus(total : int, value : int):
|
||||
if _bonus == "mult":
|
||||
return total*value
|
1
scenes/inventory/bonus/bonus.gd.uid
Normal file
1
scenes/inventory/bonus/bonus.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://c0fihxu2e7fhi
|
12
scenes/inventory/bonus/bonus.tscn
Normal file
12
scenes/inventory/bonus/bonus.tscn
Normal file
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://2o4sa1c2rd1a"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c0fihxu2e7fhi" path="res://scenes/inventory/bonus/bonus.gd" id="1_ljvlk"]
|
||||
[ext_resource type="Texture2D" uid="uid://en2he5ixrc8y" path="res://scenes/inventory/bonus/icons/mult.png" id="1_vlfj5"]
|
||||
|
||||
[node name="Bonus" type="Node2D"]
|
||||
script = ExtResource("1_ljvlk")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
z_index = -1
|
||||
position = Vector2(-0.5, 1.5)
|
||||
texture = ExtResource("1_vlfj5")
|
BIN
scenes/inventory/bonus/icons/mult.png
Normal file
BIN
scenes/inventory/bonus/icons/mult.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 217 B |
34
scenes/inventory/bonus/icons/mult.png.import
Normal file
34
scenes/inventory/bonus/icons/mult.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://en2he5ixrc8y"
|
||||
path="res://.godot/imported/mult.png-9193bf4c6e6fa797ae4ec496f528a243.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://scenes/inventory/bonus/icons/mult.png"
|
||||
dest_files=["res://.godot/imported/mult.png-9193bf4c6e6fa797ae4ec496f528a243.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
|
BIN
scenes/inventory/bonus/icons/mult.pxo
Normal file
BIN
scenes/inventory/bonus/icons/mult.pxo
Normal file
Binary file not shown.
123
scenes/inventory/inventory.gd
Normal file
123
scenes/inventory/inventory.gd
Normal file
|
@ -0,0 +1,123 @@
|
|||
extends Control
|
||||
|
||||
var items : Array[Array]
|
||||
|
||||
@onready var positive_modifiers = [$Speed,$BulletSpeed,$Ammunition,$Damage]
|
||||
@onready var negative_modifiers = [$IncomingDamage,$FiringDelay,$Size,$TaxRate]
|
||||
|
||||
var item_offset : int = 26
|
||||
|
||||
@export var bonus_scene : PackedScene
|
||||
|
||||
@export var item_scene : PackedScene
|
||||
@export var items_start : Node2D
|
||||
|
||||
@export var player : CharacterBody2D
|
||||
|
||||
func _ready():
|
||||
items.append([])
|
||||
items.append([])
|
||||
for y in range(4):
|
||||
items[0].append([])
|
||||
items[1].append([])
|
||||
for x in range(4):
|
||||
|
||||
var new_item = item_scene.instantiate()
|
||||
new_item.set_value(abs(y-x)+1)
|
||||
new_item.position = items_start.position + Vector2(x*item_offset,y*item_offset)
|
||||
new_item.last_position = Vector2i(x,y)
|
||||
new_item.inventory = self
|
||||
|
||||
items[0][y].append(new_item)
|
||||
add_child(items[0][y][x])
|
||||
|
||||
if x == y:
|
||||
var new_bonus = bonus_scene.instantiate()
|
||||
new_bonus.position = items_start.position + Vector2(x*item_offset,y*item_offset)
|
||||
new_bonus.last_position = Vector2i(x,y)
|
||||
new_bonus.inventory = self
|
||||
items[1][y].append(new_bonus)
|
||||
add_child(items[1][y][x])
|
||||
else:
|
||||
items[1][y].append(null)
|
||||
|
||||
update_calculations()
|
||||
|
||||
func update_calculations():
|
||||
for y in range(4):
|
||||
var total = 0
|
||||
for x in range(4):
|
||||
if items[0][y][x] != null and items[1][y][x] == null:
|
||||
total += items[0][y][x]._value
|
||||
if total == 0:
|
||||
total = 1
|
||||
for x in range(4):
|
||||
if items[1][y][x] != null:
|
||||
total = items[1][y][x].calculate_bonus(total, items[0][y][x]._value)
|
||||
match y:
|
||||
0:
|
||||
player.speed = total
|
||||
1:
|
||||
player.bullet_speed = total
|
||||
2:
|
||||
player.ammunition = total
|
||||
3:
|
||||
player.damage = total
|
||||
positive_modifiers[y].text = '=' + str(total)
|
||||
|
||||
for x in range(4):
|
||||
var total = 0
|
||||
for y in range(4):
|
||||
if items[0][y][x] != null and items[1][y][x] == null:
|
||||
total += items[0][y][x]._value
|
||||
if total == 0:
|
||||
total = 1
|
||||
for y in range(4):
|
||||
if items[1][y][x] != null:
|
||||
total = items[1][y][x].calculate_bonus(total, items[0][y][x]._value)
|
||||
match x:
|
||||
0:
|
||||
player.incoming_damage = total
|
||||
1:
|
||||
player.bullet_delay = total
|
||||
2:
|
||||
player.size = total
|
||||
3:
|
||||
player.tax = total
|
||||
negative_modifiers[x].text = '=' + str(total)
|
||||
|
||||
func inventory_to_global_coords(position : Vector2i) -> Vector2:
|
||||
return items_start.global_position + Vector2(position.x*item_offset,position.y*item_offset)
|
||||
|
||||
func global_to_inventory_coords(position : Vector2):
|
||||
position -= (items_start.global_position-Vector2(item_offset/2,item_offset/2))
|
||||
position = Vector2i(position)
|
||||
|
||||
|
||||
if position.x < 0 or position.y < 0:
|
||||
return null
|
||||
|
||||
position /= item_offset
|
||||
|
||||
position = Vector2i(position)
|
||||
|
||||
if position.x >= 4 or position.y >= 4:
|
||||
return null
|
||||
|
||||
return position
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseButton:
|
||||
var layer = 0
|
||||
if (event.button_index == MOUSE_BUTTON_LEFT or event.button_index == MOUSE_BUTTON_RIGHT) and event.pressed:
|
||||
if(event.button_index == MOUSE_BUTTON_RIGHT):
|
||||
layer = 1
|
||||
var inventory_position = global_to_inventory_coords(event.position)
|
||||
if inventory_position != null and items[layer][inventory_position.y][inventory_position.x] != null:
|
||||
items[layer][inventory_position.y][inventory_position.x].dragging = true
|
||||
items[layer][inventory_position.y][inventory_position.x].last_position = Vector2i(inventory_position.x,inventory_position.y)
|
||||
items[layer][inventory_position.y][inventory_position.x] = null
|
1
scenes/inventory/inventory.gd.uid
Normal file
1
scenes/inventory/inventory.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://466pugqribug
|
124
scenes/inventory/inventory.tscn
Normal file
124
scenes/inventory/inventory.tscn
Normal file
|
@ -0,0 +1,124 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://o6e5ybx262ig"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://466pugqribug" path="res://scenes/inventory/inventory.gd" id="1_el5y6"]
|
||||
[ext_resource type="PackedScene" uid="uid://csdmile32lfyy" path="res://scenes/inventory/number/number.tscn" id="2_4axmw"]
|
||||
[ext_resource type="Texture2D" uid="uid://wygld7k1t3ad" path="res://scenes/inventory/WindowPane.png" id="4_bxceu"]
|
||||
[ext_resource type="FontFile" uid="uid://cukc34hue3c0h" path="res://etc/pixelated.ttf" id="4_tvok8"]
|
||||
[ext_resource type="PackedScene" uid="uid://2o4sa1c2rd1a" path="res://scenes/inventory/bonus/bonus.tscn" id="5_bxceu"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_bxceu"]
|
||||
font = ExtResource("4_tvok8")
|
||||
font_size = 8
|
||||
font_color = Color(0.772549, 0.411765, 0.505882, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_kl7fi"]
|
||||
font = ExtResource("4_tvok8")
|
||||
font_size = 8
|
||||
font_color = Color(0.156863, 0.137255, 0.156863, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_v8e04"]
|
||||
font = ExtResource("4_tvok8")
|
||||
font_size = 8
|
||||
font_color = Color(0.329412, 0.360784, 0.494118, 1)
|
||||
|
||||
[node name="Inventory" type="Control" node_paths=PackedStringArray("items_start")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 6
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_el5y6")
|
||||
bonus_scene = ExtResource("5_bxceu")
|
||||
item_scene = ExtResource("2_4axmw")
|
||||
items_start = NodePath("InventoryStart")
|
||||
|
||||
[node name="WindowPane" type="Sprite2D" parent="."]
|
||||
z_index = -2
|
||||
texture_repeat = 3
|
||||
position = Vector2(-64, 0)
|
||||
texture = ExtResource("4_bxceu")
|
||||
region_rect = Rect2(0, 0, 134, 256)
|
||||
|
||||
[node name="InventoryStart" type="Marker2D" parent="."]
|
||||
position = Vector2(-110, -111)
|
||||
|
||||
[node name="Speed" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = -20.0
|
||||
offset_top = -122.0
|
||||
offset_bottom = -99.0
|
||||
text = "=10"
|
||||
label_settings = SubResource("LabelSettings_bxceu")
|
||||
|
||||
[node name="RemainingAmmunition" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = -105.0
|
||||
offset_top = 26.0
|
||||
offset_right = -85.0
|
||||
offset_bottom = 49.0
|
||||
text = "- 100"
|
||||
label_settings = SubResource("LabelSettings_kl7fi")
|
||||
|
||||
[node name="BulletSpeed" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = -20.0
|
||||
offset_top = -96.0
|
||||
offset_right = -8.0
|
||||
offset_bottom = -87.0
|
||||
text = "=10"
|
||||
label_settings = SubResource("LabelSettings_bxceu")
|
||||
|
||||
[node name="Ammunition" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = -20.0
|
||||
offset_top = -70.0
|
||||
offset_bottom = -47.0
|
||||
text = "=10"
|
||||
label_settings = SubResource("LabelSettings_bxceu")
|
||||
|
||||
[node name="Damage" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = -20.0
|
||||
offset_top = -44.0
|
||||
offset_bottom = -21.0
|
||||
text = "=10"
|
||||
label_settings = SubResource("LabelSettings_bxceu")
|
||||
|
||||
[node name="Size" type="Label" parent="."]
|
||||
offset_left = -71.0
|
||||
offset_top = -17.0
|
||||
offset_right = -46.0
|
||||
offset_bottom = 6.0
|
||||
text = "=10"
|
||||
label_settings = SubResource("LabelSettings_v8e04")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="TaxRate" type="Label" parent="."]
|
||||
offset_left = -46.0
|
||||
offset_top = -17.0
|
||||
offset_right = -21.0
|
||||
offset_bottom = 6.0
|
||||
text = "=10"
|
||||
label_settings = SubResource("LabelSettings_v8e04")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="FiringDelay" type="Label" parent="."]
|
||||
offset_left = -98.0
|
||||
offset_top = -17.0
|
||||
offset_right = -73.0
|
||||
offset_bottom = 6.0
|
||||
text = "=10"
|
||||
label_settings = SubResource("LabelSettings_v8e04")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="IncomingDamage" type="Label" parent="."]
|
||||
offset_left = -124.0
|
||||
offset_top = -17.0
|
||||
offset_right = -99.0
|
||||
offset_bottom = 6.0
|
||||
text = "=10"
|
||||
label_settings = SubResource("LabelSettings_v8e04")
|
||||
horizontal_alignment = 1
|
35
scenes/inventory/item.gd
Normal file
35
scenes/inventory/item.gd
Normal file
|
@ -0,0 +1,35 @@
|
|||
extends Node2D
|
||||
|
||||
class_name Item
|
||||
|
||||
var inventory : Control
|
||||
|
||||
var dragging = false
|
||||
|
||||
var last_position = null
|
||||
|
||||
var layer = 0
|
||||
|
||||
func _process(delta):
|
||||
if not dragging: return
|
||||
global_position = get_global_mouse_position()
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseButton:
|
||||
if ((event.button_index == MOUSE_BUTTON_LEFT and layer == 0) or (event.button_index == MOUSE_BUTTON_RIGHT and layer == 1)) and not event.pressed :
|
||||
dragging = false
|
||||
var inventory_position = inventory.global_to_inventory_coords(global_position)
|
||||
if inventory_position != null and last_position != Vector2i(inventory_position):
|
||||
var temp = inventory.items[layer][inventory_position.y][inventory_position.x]
|
||||
inventory.items[layer][inventory_position.y][inventory_position.x] = self
|
||||
inventory.items[layer][last_position.y][last_position.x] = temp
|
||||
global_position = inventory.inventory_to_global_coords(Vector2i(inventory_position.x,inventory_position.y))
|
||||
if last_position != null:
|
||||
if temp != null:
|
||||
inventory.items[layer][last_position.y][last_position.x].global_position = inventory.inventory_to_global_coords(Vector2i(last_position.x,last_position.y))
|
||||
inventory.items[layer][last_position.y][last_position.x].last_position = Vector2i(last_position.x,last_position.y)
|
||||
last_position = Vector2i(inventory_position.x,inventory_position.y)
|
||||
elif last_position != null and inventory.items[layer][last_position.y][last_position.x] == null:
|
||||
inventory.items[layer][last_position.y][last_position.x] = self
|
||||
global_position = inventory.inventory_to_global_coords(Vector2i(last_position.x,last_position.y))
|
||||
inventory.call_deferred("update_calculations")
|
1
scenes/inventory/item.gd.uid
Normal file
1
scenes/inventory/item.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://muf4bbw3c4na
|
9
scenes/inventory/number/number.gd
Normal file
9
scenes/inventory/number/number.gd
Normal file
|
@ -0,0 +1,9 @@
|
|||
extends Item
|
||||
|
||||
class_name Number
|
||||
@export var label : Label
|
||||
@export var _value : int = 1
|
||||
|
||||
func set_value(new_value : int):
|
||||
_value = new_value
|
||||
label.text = str(_value)
|
1
scenes/inventory/number/number.gd.uid
Normal file
1
scenes/inventory/number/number.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://doutbj4troo25
|
30
scenes/inventory/number/number.tscn
Normal file
30
scenes/inventory/number/number.tscn
Normal file
|
@ -0,0 +1,30 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://csdmile32lfyy"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://doutbj4troo25" path="res://scenes/inventory/number/number.gd" id="1_jg50s"]
|
||||
[ext_resource type="FontFile" uid="uid://dxcsr8pfoj3c" path="res://etc/bulletinV1.ttf" id="1_wvpe8"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_jg50s"]
|
||||
font = ExtResource("1_wvpe8")
|
||||
font_size = 19
|
||||
font_color = Color(0.156863, 0.137255, 0.156863, 1)
|
||||
|
||||
[node name="Item" type="Node2D" node_paths=PackedStringArray("label")]
|
||||
script = ExtResource("1_jg50s")
|
||||
label = NodePath("Label")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -13.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 13.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "1"
|
||||
label_settings = SubResource("LabelSettings_jg50s")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
60
scenes/player/player.gd
Normal file
60
scenes/player/player.gd
Normal file
|
@ -0,0 +1,60 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
var base_speed = 100
|
||||
|
||||
var speed
|
||||
var bullet_speed
|
||||
var ammunition
|
||||
var damage
|
||||
|
||||
var incoming_damage
|
||||
var bullet_delay
|
||||
var size = 100
|
||||
var tax
|
||||
|
||||
var remaining_bullets = 100
|
||||
|
||||
var bullet_timer = 0
|
||||
|
||||
@onready var sprite = $CollisionShape2D/Sprite2D
|
||||
@onready var collision = $CollisionShape2D
|
||||
|
||||
@export var inventory : Control
|
||||
|
||||
@export var bullet_scene : PackedScene
|
||||
|
||||
func _physics_process(delta):
|
||||
bullet_timer -= delta
|
||||
velocity = Vector2(0,0)
|
||||
if Input.is_action_pressed("left"):
|
||||
velocity.x += -1
|
||||
if Input.is_action_pressed("right"):
|
||||
velocity.x += 1
|
||||
if Input.is_action_pressed("up"):
|
||||
velocity.y += -1
|
||||
if Input.is_action_pressed("down"):
|
||||
velocity.y += 1
|
||||
|
||||
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
|
||||
spawn_bullet()
|
||||
|
||||
velocity = velocity.normalized() * speed*base_speed*delta
|
||||
|
||||
move_and_slide()
|
||||
sprite.global_position = Vector2i(global_position)
|
||||
|
||||
collision.scale = Vector2(0.3,0.3)*(pow(size,0.2))
|
||||
|
||||
func reload():
|
||||
pass
|
||||
|
||||
func spawn_bullet():
|
||||
if bullet_timer > 0: return
|
||||
var new_bullet = bullet_scene.instantiate()
|
||||
new_bullet.direction = global_position.direction_to(get_global_mouse_position())
|
||||
new_bullet.position = position
|
||||
new_bullet.speed = sqrt(bullet_speed)
|
||||
|
||||
get_tree().root.add_child(new_bullet)
|
||||
|
||||
bullet_timer = 0.1*pow(bullet_delay,0.4)
|
1
scenes/player/player.gd.uid
Normal file
1
scenes/player/player.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://cgfntug3512wn
|
BIN
scenes/player/player.png
Normal file
BIN
scenes/player/player.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 285 B |
34
scenes/player/player.png.import
Normal file
34
scenes/player/player.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bhjcs3u6blng7"
|
||||
path="res://.godot/imported/player.png-d340f81abf0a3162ec6e69b8e169a012.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://scenes/player/player.png"
|
||||
dest_files=["res://.godot/imported/player.png-d340f81abf0a3162ec6e69b8e169a012.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
|
20
scenes/player/player.tscn
Normal file
20
scenes/player/player.tscn
Normal file
|
@ -0,0 +1,20 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://citwevx7xvypn"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bhjcs3u6blng7" path="res://scenes/player/player.png" id="1_8afob"]
|
||||
[ext_resource type="Script" uid="uid://cgfntug3512wn" path="res://scenes/player/player.gd" id="1_dovo2"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpdt7rbma7ugn" path="res://scenes/bullet/bullet.tscn" id="2_gmlin"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_dovo2"]
|
||||
radius = 13.0
|
||||
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
motion_mode = 1
|
||||
script = ExtResource("1_dovo2")
|
||||
bullet_scene = ExtResource("2_gmlin")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
scale = Vector2(0.3, 0.3)
|
||||
shape = SubResource("CircleShape2D_dovo2")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="CollisionShape2D"]
|
||||
texture = ExtResource("1_8afob")
|
15
scenes/world/world.tscn
Normal file
15
scenes/world/world.tscn
Normal file
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dinanmpmnja1"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://o6e5ybx262ig" path="res://scenes/inventory/inventory.tscn" id="1_dphjl"]
|
||||
[ext_resource type="PackedScene" uid="uid://citwevx7xvypn" path="res://scenes/player/player.tscn" id="2_sl2e5"]
|
||||
|
||||
[node name="World" type="Node2D"]
|
||||
|
||||
[node name="UI" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="Inventory" parent="UI" node_paths=PackedStringArray("player") instance=ExtResource("1_dphjl")]
|
||||
player = NodePath("../../Player")
|
||||
|
||||
[node name="Player" parent="." node_paths=PackedStringArray("inventory") instance=ExtResource("2_sl2e5")]
|
||||
position = Vector2(131, 131)
|
||||
inventory = NodePath("../UI/Inventory")
|
Loading…
Reference in a new issue