Skip to content

Commit

Permalink
2D Movment, Ammo items and ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Trey2k committed Oct 13, 2023
1 parent 67d3d8c commit cf40d21
Show file tree
Hide file tree
Showing 61 changed files with 831 additions and 229 deletions.
93 changes: 93 additions & 0 deletions assets/fonts/pixel_code/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright (c) 2022, Qwerasd

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file added assets/fonts/pixel_code/PixelCode.otf
Binary file not shown.
33 changes: 33 additions & 0 deletions assets/fonts/pixel_code/PixelCode.otf.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[remap]

importer="font_data_dynamic"
type="FontFile"
uid="uid://drxtf8blqxxh1"
path="res://.godot/imported/PixelCode.otf-0abd59be39299b913acc138c1b8f037e.fontdata"

[deps]

source_file="res://assets/fonts/pixel_code/PixelCode.otf"
dest_files=["res://.godot/imported/PixelCode.otf-0abd59be39299b913acc138c1b8f037e.fontdata"]

[params]

Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}
Binary file removed assets/images/projectile/bullet.xcf
Binary file not shown.
1 change: 1 addition & 0 deletions assets/images/projectile/phaser/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Assets from https://opengameart.org/content/assets-free-laser-bullets-pack-2020
Binary file added assets/images/projectile/phaser/red_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

importer="texture"
type="CompressedTexture2D"
uid="uid://c0si2aupdqaof"
path="res://.godot/imported/projectile.webp-a2911779084e71e11e41c51bef2269ea.ctex"
uid="uid://hvuku7lpqby1"
path="res://.godot/imported/red_01.png-b999c303c3112d4c8b9c0334c6cd387e.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/images/projectile/projectile.webp"
dest_files=["res://.godot/imported/projectile.webp-a2911779084e71e11e41c51bef2269ea.ctex"]
source_file="res://assets/images/projectile/phaser/red_01.png"
dest_files=["res://.godot/imported/red_01.png-b999c303c3112d4c8b9c0334c6cd387e.ctex"]

[params]

Expand Down
Binary file added assets/images/projectile/phaser/red_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/images/projectile/phaser/red_02.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bo5sa3pbjcufm"
path="res://.godot/imported/red_02.png-fd58fca7fae36efb80352cbfdbcff0ae.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/images/projectile/phaser/red_02.png"
dest_files=["res://.godot/imported/red_02.png-fd58fca7fae36efb80352cbfdbcff0ae.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
Binary file removed assets/images/projectile/projectile.webp
Binary file not shown.
2 changes: 1 addition & 1 deletion assets/shaders/effects/blur.tres
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

[resource]
shader = ExtResource("1_b6fhc")
shader_parameter/amount = null
shader_parameter/amount = 3.0
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://gybsnxxx6x3f"]

[ext_resource type="Shader" path="res://assets/shaders/health_bar/health_bar.gdshader" id="1_cp53s"]
[ext_resource type="Shader" path="res://assets/shaders/ui/health_bar/health_bar.gdshader" id="1_cp53s"]

[resource]
render_priority = 0
Expand Down
7 changes: 7 additions & 0 deletions assets/shaders/ui/weapon_status/weapon_status.gdshader
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
shader_type canvas_item;

uniform float progress;

void fragment() {
COLOR.rgba = vec4(COLOR.rgba - vec4(0.0, 0.0, 0.0, progress));
}
7 changes: 7 additions & 0 deletions assets/shaders/ui/weapon_status/weapon_status.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://bqhu74bk858wj"]

[ext_resource type="Shader" path="res://assets/shaders/ui/weapon_status/weapon_status.gdshader" id="1_bhft8"]

[resource]
shader = ExtResource("1_bhft8")
shader_parameter/progress = null
6 changes: 6 additions & 0 deletions assets/themes/main.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://7u3vc13ppdl0"]

[ext_resource type="FontFile" uid="uid://drxtf8blqxxh1" path="res://assets/fonts/pixel_code/PixelCode.otf" id="1_gmgni"]

[resource]
default_font = ExtResource("1_gmgni")
42 changes: 32 additions & 10 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ config/icon="res://icon.svg"

UI="*res://src/ui.gd"
EventBus="*res://src/event_bus.gd"
GameManager="*res://src/game_manager.gd"
GameState="*res://src/game_state.gd"
EnemyManager="*res://src/enemy_manager.gd"

Expand All @@ -31,34 +30,57 @@ window/size/viewport_height=1080

[input]

spaceship_left={
spaceship_strafe_left={
"deadzone": 0.5,
"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,"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,"echo":false,"script":null)
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"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":81,"key_label":0,"unicode":113,"echo":false,"script":null)
]
}
spaceship_right={
spaceship_strafe_right={
"deadzone": 0.5,
"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,"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,"echo":false,"script":null)
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"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":69,"key_label":0,"unicode":101,"echo":false,"script":null)
]
}
spaceship_fire={
"deadzone": 0.5,
"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":32,"key_label":0,"unicode":32,"echo":false,"script":null)
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(398, 11),"global_position":Vector2(402, 54),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":5,"axis_value":1.0,"script":null)
]
}
spaceship_forward={
"deadzone": 0.5,
"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,"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,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
]
}
spaceship_break={
spaceship_backward={
"deadzone": 0.5,
"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,"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,"echo":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
]
}
spaceship_rotate_left={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":true,"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":65,"key_label":0,"unicode":97,"echo":false,"script":null)
]
}
spaceship_rotate_right={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":true,"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":68,"key_label":0,"unicode":100,"echo":false,"script":null)
]
}
spaceship_weapons_up={
"deadzone": 0.5,
"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":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
spaceship_weapons_down={
"deadzone": 0.5,
"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":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}

Expand Down
19 changes: 19 additions & 0 deletions scenes/items/ammo/ammo.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class_name Ammo
extends RefCounted

var projectile_scene: PackedScene
var projectile_type: Projectile.ProjectileType
var projectile_count: int

var item_icon: Texture2D

func _init(icon: Texture2D, scene: PackedScene, type: Projectile.ProjectileType, count: int) -> void:
self.item_icon = icon
self.projectile_scene = scene
self.projectile_type = type
self.projectile_count = count

func consume_ammo():
if projectile_count < 0:
return
projectile_count -= 1
9 changes: 9 additions & 0 deletions scenes/items/ammo/ammo_item.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class_name AmmoItem
extends Item

@export var projectile_scene: PackedScene
@export var projectile_type: Projectile.ProjectileType
@export var projectile_count: int

func get_ammo() -> Ammo:
return Ammo.new(item_icon, projectile_scene, projectile_type, projectile_count)
11 changes: 11 additions & 0 deletions scenes/items/ammo/ammo_item.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[gd_scene load_steps=3 format=3 uid="uid://dlwb16yqdtgtb"]

[ext_resource type="Script" path="res://scenes/items/ammo/ammo_item.gd" id="1_44jtn"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_utth4"]

[node name="AmmoItem" type="Area2D"]
script = ExtResource("1_44jtn")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_utth4")
1 change: 1 addition & 0 deletions scenes/items/ammo/missile_ammo/missile_ammo.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends AmmoItem
22 changes: 22 additions & 0 deletions scenes/items/ammo/missile_ammo/missile_ammo.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[gd_scene load_steps=5 format=3 uid="uid://c5gppqo8phv1n"]

[ext_resource type="Script" path="res://scenes/items/ammo/missile_ammo/missile_ammo.gd" id="1_jjift"]
[ext_resource type="PackedScene" uid="uid://be81tbuwykao8" path="res://scenes/projectiles/missile/missile.tscn" id="2_kuvrw"]
[ext_resource type="Texture2D" uid="uid://d3jeifgalw07w" path="res://assets/images/projectile/missile/missile0.webp" id="3_jvm7e"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_x6ijy"]
size = Vector2(60, 10)

[node name="MissileAmmo" type="Area2D"]
script = ExtResource("1_jjift")
projectile_scene = ExtResource("2_kuvrw")
projectile_type = 1
projectile_count = 5
item_icon = ExtResource("3_jvm7e")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(6, 0)
shape = SubResource("RectangleShape2D_x6ijy")

[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("3_jvm7e")
5 changes: 5 additions & 0 deletions scenes/items/ammo/phaser_ammo/phaser_ammo.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extends AmmoItem

func get_ammo() -> Ammo:
var ammo = Ammo.new(item_icon, projectile_scene, projectile_type, projectile_count)
return ammo
22 changes: 22 additions & 0 deletions scenes/items/ammo/phaser_ammo/phaser_ammo.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[gd_scene load_steps=5 format=3 uid="uid://3muskpfron44"]

[ext_resource type="Script" path="res://scenes/items/ammo/phaser_ammo/phaser_ammo.gd" id="1_muxvb"]
[ext_resource type="PackedScene" uid="uid://ceyv85t3m1p4r" path="res://scenes/projectiles/phaser/phaser.tscn" id="2_fbv8e"]
[ext_resource type="Texture2D" uid="uid://bo5sa3pbjcufm" path="res://assets/images/projectile/phaser/red_02.png" id="4_yq24i"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_opxcc"]
size = Vector2(17, 156)

[node name="PhaserAmmo" type="Area2D"]
script = ExtResource("1_muxvb")
projectile_scene = ExtResource("2_fbv8e")
projectile_count = -1
item_icon = ExtResource("4_yq24i")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-0.5, 9)
shape = SubResource("RectangleShape2D_opxcc")

[node name="Sprite2D" type="Sprite2D" parent="."]
rotation = 4.71239
texture = ExtResource("4_yq24i")
Loading

0 comments on commit cf40d21

Please sign in to comment.