diff --git a/SUPPORTERS.md b/SUPPORTERS.md deleted file mode 100644 index a08f573..0000000 --- a/SUPPORTERS.md +++ /dev/null @@ -1,36 +0,0 @@ -This is a list of people who decided to support my plugin with donations. Even though they are not explicitly requested, they would help me pay a part of my university fees and also encourage me to keep my projects updated and make new ones. -*A huge thank you to:* -- Russel aka [masterworm2](https://github.com/masterworm2) -- Autcru aka [autcru](https://github.com/autcru) -- Itch.io users (can't publish their name until their agreement) - - - - - - - - - - - - - - - - - - - - - - - - - - - ------------------ -> This text file was created via [TextEditor Integration](https://github.com/fenix-hub/godot-engine.text-editor) inside Godot Engine's Editor. - - diff --git a/VERSION.md b/VERSION.md deleted file mode 100644 index f0796b6..0000000 --- a/VERSION.md +++ /dev/null @@ -1,175 +0,0 @@ -**version 0.1.5** -*added* -+ Light code clean -+ Some Bugfix -+ Plugin output for debug of some of the operations -+ Automatic Filling of sign in fields -+ Multiple files commit and changes commit -+ Every text and image file format supported -+ Filtering in committing -+ Autoload branches content - -*removed* -+ Single file commit -+ Only text file commit - ----------------------- - -**version 0.2.5** -*added* -+ Code clean -+ Chose branch to commit -+ Delete resource selected in repository -+ Filters: Exceptions, Only, Start from - ----------------------- - -**version 0.2.7** -*added* -+ Code clean -+ Fix some little animations -+ New commit method: tree created from blobs, creates a single commit with more files - -*removed* -+ Old commit method - ----------------------- - -**version 0.2.9** -*added* -+ Code clean -+ Bugfix with commits -+ A marker next to "Sign-in" buttons appears if a logfile is found - ----------------------- - -**version 0.3.1** -*added* -+ Several bugfixes - --------------------- - -**version 0.3.2** -*added* -+ New folder organization (whole plugin in *addon* folder) -+ New install method (AssetLib from GodotEngine Editor) - --------------------- - -**version 0.6.0** -*removed* -- old position: - - the plugin doesn't appear in docs anymore. Instead, it will load a new tool in the top toolbar -- old layout: - - RepositoryList and GistList now show more informations about their contents -- old repository's content system: - - Repositories contents are now listed in a tree way -- old "commit to repository" system and FILTERS: - - The old system was based on a Filtering system: I introduced filters to help people choose which file to exclude from your commit, which files should negate an exclusion, and eventually from which path to start. This system was based on the conception that the whole commit started from the `res://` path. Now, you can select in a more interactive way all files and folders you want to commit, and exclude them with a .gitignore system. - -*added* -+ Informations about repositories: - + Repositories now have their own icons: *lock* for private, *fork* for forked repositories, *gray repo* for own public repositories - + Repositories show their forked times and stars -+ License templates: new repositories can now be created with a license template from all availables github supported licenses -+ Repository contents system: - + files are now displayed in a compact, more readable tree system. Files and folders are differentiated, and folders can be folded and unfolded to show their contents - + you can now delete multiple files just CTRL/SHIFT selecting them. **remember:** folders cannot be deleted by github integrity rules. Delete all folder's contents to delete the folder itself - + you can now create a new branch from all selectable branches in your repository -+ **!Repository committing system**: - + [filtering] - + Since FILTERS are not supported anymore, the usage of `.gitignore` is now implemented. - + a `.gitignore` file is loaded from the repository you want to commit to. If this repository doesn't have a gitignore, an empty and new gitignore can be created and committed. - + the "gitignore editor" is shown next to the "committing tree" so you can procedurally select files and folders, and exclude/include them with the gitignore. *if you don't know how to use a gitignore, I recommend you to click on the `?` button in the bottom-right of the gitignore editor* - + the "edit .gitignore" button will prevent any unwanted modifications to be applied by any chance (miss-typing, or you just don't need to edit the gitignore since it was loaded from the repository) - + [file choosing] - + Since FILTERS are not supported anymore, the commit process won't start from the project folder. - + Now you can select multiple files and directories you want to commit through a file dialog showing your whole project folder. - + Files and directories can always be removed before committing -**Please, note that the gitignore filtering method is custom made. To fully support the same gitignore method applied by GitHub some tests are needed** -+ **Gists** can now be opened, edited, and pushed with a cusotm GitEditor. Gists which contain more than one file are supported, and you can edit more files at the same time. - --------------------- - -**version 0.6.2** -*fixed* -- new method to show contents of repositories: faster code and works better. Empty repositories won't be loaded -- now each loading has a loading screen covering the whole scene: no more missclicks during a repository loading or a commit -- new icons in repositories to visually show what's the content type ( adapted to Godot Engine's file types) - --------------------- - -**version 0.7.0** -*added* -- **pull / clone button** : you can now pull from any branch of a selected repository. A local copy of your repository with files relative to the selected branch will be created in a .zip file inside your 'res://' folder. In this way you will be able to manage your repository's files in the way you prefer. Pulling/Cloning works on public, private and forked repositories. - --------------------- - -**version 0.7.2** -*added* -- **debug messages checkbox** : a new checkbox will appear on the top-left corner of the GUI. With this checkbox you can decide if you want to get debug messages from this plugin or not. You can enable/disable it in any plugin tab - -*fidex* -- **deleting repository's resources** : with the previous version a bug occured and it wasn't possible to delete resources within a repository. - - -------------------- - -**version 0.7.4** -*added* -- **auto extraction** : the plugin is now able to auto-extract downloaded archives automatically. _your OS needs python_ to run the extraction script since it is not currently built in Godot Engine. It is still a beta script, so it is highly recommended to use it inside empty projects and have some tests. You can always report issues and contact me for any bug. -- **sing up link** : if you don't have an account, or want to create a new one, you can click on the *'Don't have a GitHub account yet?'* button in the main tab of the plugin - - -------------------- - -**version 0.7.5** -*fixed* -- **minor bugs** - --------------------- - -**version 0.7.8** -*fixed* -- *[!] icon for log file* appeared even though there weren't log files already stored -- increased the number of repositories that will be listed. Default GitHub repository listing provides only 30 repositories at time. Now the limit is increased to 100. - -*added* -- user's datas are now stored in an **encrypted file**, and datas are shared on an upper level folder. Now you won't need to save the same datas for each 'github integration' plugin you install in your new projects, but all the projects you have and in which you use this plugin will always use the same log file. This log file will be stored at `/AppData/Roaming/Godot/github_integration/` -- the plugin now supports two different unzipping methods, one with a *Python script* and one with a *GDScript*. The second one is offered by an external plugin, which is the [gdunzip](https://github.com/jellehermsen/gdunzip) plugin developed by [jellehermsen](https://github.com/jellehermsen) (please, check it out!!). **NOTE:** If you've got Python installed on your PC, it is recommended using the Python one, since the GDScript one is not developed by me and may not work. In that case, please make an issue with specific informations about the problem you've encountered, and I'll make sure to discuss about it with the developer. - --------------------- - -**version 0.8.2** -*fixed* -- autoload errors with 3.2 beta versions (and so on) -- some interface bugs -- minor bugfixes - -*added* -- **new authentication method** : it is now possible to log into your GitHub profile with an *Access Token*. Since GitHub will deprecate the basic authentication method (which consists of `your e-mail : your password`) this plugin will **only work** with your personal access token. -Please, visit [this site](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) to understand what a Personal Access Token is, and how to use it. You will also find this link as a button in the plugin. - --------------------- - -**version 0.8.4** -*fixed* -- plugin ui -- extraction methods - -*added* -- introduced a java extraction method for zip files. - -------------------- -**version 0.9.0** -*fixed* -- opening shared repositories - -*added* -- new repositories explorer -- search bar for repositories - ------------------ -> This text file was created via [TextEditor Integration](https://github.com/fenix-hub/godot-engine.text-editor) inside Godot Engine's Editor. - - - - diff --git a/art/Pedestal.png b/art/Pedestal.png index 841052a..f196d34 100644 Binary files a/art/Pedestal.png and b/art/Pedestal.png differ diff --git a/art/chest.png b/art/chest.png new file mode 100644 index 0000000..1138cad Binary files /dev/null and b/art/chest.png differ diff --git a/art/chest.png.import b/art/chest.png.import new file mode 100644 index 0000000..095612a --- /dev/null +++ b/art/chest.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/chest.png-541bf735874d6a9d8155622ae282e21b.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://art/chest.png" +dest_files=[ "res://.import/chest.png-541bf735874d6a9d8155622ae282e21b.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=false +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=false +svg/scale=1.0 diff --git a/characters/Player.tscn b/characters/Player.tscn index 48e302e..7a44776 100644 --- a/characters/Player.tscn +++ b/characters/Player.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=11 format=2] +[gd_scene load_steps=12 format=2] [ext_resource path="res://script/player.gd" type="Script" id=1] -[ext_resource path="res://meta/BoundedCamera.tscn" type="PackedScene" id=2] -[ext_resource path="res://script/PlayerStateMachine.gd" type="Script" id=3] -[ext_resource path="res://art/Wand.png" type="Texture" id=4] -[ext_resource path="res://art/WizardM.png" type="Texture" id=5] +[ext_resource path="res://ui/PlayerStats.tscn" type="PackedScene" id=2] +[ext_resource path="res://meta/BoundedCamera.tscn" type="PackedScene" id=3] +[ext_resource path="res://script/PlayerStateMachine.gd" type="Script" id=4] +[ext_resource path="res://magic/Wands/BasicWand.tscn" type="PackedScene" id=5] +[ext_resource path="res://art/WizardM.png" type="Texture" id=6] [sub_resource type="OccluderPolygon2D" id=1] polygon = PoolVector2Array( -7, 0, -7, -2, -6, -2, -6, -3, -5, -3, -5, -5, -6, -5, -6, -10, -7, -10, -7, -12, -6, -12, -6, -19, -4, -19, -4, -18, -3, -18, -3, -17, 1, -17, 1, -16, 3, -16, 3, -15, 4, -15, 4, -14, 5, -14, 5, -13, 6, -13, 6, -12, 7, -12, 7, -10, 6, -10, 6, -9, 5, -9, 5, -8, 6, -8, 6, -4, 5, -4, 5, 0, -7, 0 ) @@ -66,7 +67,10 @@ tracks/0/keys = { collision_mask = 2 script = ExtResource( 1 ) -[node name="Node2D" parent="." instance=ExtResource( 2 )] +[node name="Stats" parent="." instance=ExtResource( 2 )] + +[node name="Camera" parent="." instance=ExtResource( 3 )] +position = Vector2( 0, -7 ) current = true smoothing_enabled = true drag_margin_left = 0.0 @@ -75,24 +79,17 @@ drag_margin_right = 0.0 drag_margin_bottom = 0.0 [node name="PlayerStateMachine" type="Node" parent="."] -script = ExtResource( 3 ) +script = ExtResource( 4 ) [node name="HoldPosition" type="Position2D" parent="."] -position = Vector2( 0, -6 ) -rotation = 1.5708 +position = Vector2( 0, -7 ) -[node name="Wand" type="Sprite" parent="HoldPosition"] -position = Vector2( 9, -4.76837e-007 ) -rotation = 1.5708 -texture = ExtResource( 4 ) - -[node name="ProjectileSpawn" type="Position2D" parent="HoldPosition"] -position = Vector2( 17, -9.53674e-007 ) -rotation = 1.5708 +[node name="Wand" parent="HoldPosition" instance=ExtResource( 5 )] +position = Vector2( 14, 0 ) [node name="Sprite" type="Sprite" parent="."] position = Vector2( 0, -12 ) -texture = ExtResource( 5 ) +texture = ExtResource( 6 ) vframes = 3 hframes = 4 @@ -126,4 +123,4 @@ position = Vector2( 0, -7 ) [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hitbox"] visible = false polygon = PoolVector2Array( -6, -12, -6, -5, -7, -5, -7, -3, -6, -3, -6, 2, -5, 2, -5, 4, -6, 4, -6, 5, -7, 5, -7, 7, 5, 7, 5, 3, 6, 3, 6, -1, 5, -1, 5, -2, 6, -2, 6, -3, 7, -3, 7, -5, 6, -5, 6, -6, 5, -6, 5, -7, 4, -7, 4, -8, 3, -8, 3, -9, 1, -9, 1, -10, -3, -10, -3, -11, -4, -11, -4, -12, -6, -12 ) -[connection signal="grounded_updated" from="." to="Node2D" method="_on_grounded_updated"] +[connection signal="grounded_updated" from="." to="Camera" method="_on_grounded_updated"] diff --git a/levels/test.tscn b/levels/test.tscn index 2065691..b205ef9 100644 --- a/levels/test.tscn +++ b/levels/test.tscn @@ -6,7 +6,7 @@ [node name="Node2D" type="Node2D"] [node name="Player" parent="." instance=ExtResource( 1 )] -position = Vector2( 152, 157 ) +position = Vector2( 60, 176 ) [node name="TileMap" parent="." instance=ExtResource( 2 )] -tile_data = PoolIntArray( 0, 0, 8, 1, 0, 10, 2, 0, 10, 3, 0, 10, 4, 0, 10, 5, 0, 10, 6, 0, 10, 7, 0, 10, 8, 0, 10, 9, 0, 10, 10, 0, 10, 11, 0, 10, 12, 0, 10, 13, 0, 10, 14, 0, 10, 15, 0, 10, 16, 0, 10, 17, 0, 10, 18, 0, 10, 19, 0, 10, 20, 0, 10, 21, 0, 11, 65536, 0, 65544, 65537, 0, 131078, 65538, 0, 196617, 65539, 0, 196617, 65540, 0, 196617, 65541, 0, 196617, 65542, 0, 196617, 65543, 0, 196617, 65544, 0, 196617, 65545, 0, 196617, 65546, 0, 196617, 65547, 0, 196617, 65548, 0, 196617, 65549, 0, 196617, 65550, 0, 196617, 65551, 0, 196617, 65552, 0, 196617, 65553, 0, 196617, 65554, 0, 196617, 65555, 0, 196617, 65556, 0, 131077, 65557, 0, 131083, 131072, 0, 65544, 131073, 0, 131083, 131092, 0, 65544, 131093, 0, 131083, 196608, 0, 65544, 196609, 0, 131083, 196628, 0, 65544, 196629, 0, 131083, 262144, 0, 65544, 262145, 0, 131083, 262164, 0, 65544, 262165, 0, 131083, 327680, 0, 65544, 327681, 0, 131083, 327700, 0, 65544, 327701, 0, 131083, 393216, 0, 65544, 393217, 0, 131083, 393236, 0, 65544, 393237, 0, 131083, 458752, 0, 65544, 458753, 0, 131083, 458772, 0, 65544, 458773, 0, 131083, 524288, 0, 65544, 524289, 0, 131083, 524308, 0, 65544, 524309, 0, 131083, 589824, 0, 65544, 589825, 0, 131083, 589844, 0, 65544, 589845, 0, 131083, 655360, 0, 65544, 655361, 0, 131083, 655380, 0, 65544, 655381, 0, 131083, 720896, 0, 65544, 720897, 0, 65542, 720898, 0, 10, 720899, 0, 10, 720900, 0, 10, 720901, 0, 10, 720902, 0, 10, 720903, 0, 10, 720904, 0, 10, 720905, 0, 10, 720906, 0, 10, 720907, 0, 10, 720908, 0, 10, 720909, 0, 10, 720910, 0, 10, 720911, 0, 10, 720912, 0, 10, 720913, 0, 10, 720914, 0, 10, 720915, 0, 10, 720916, 0, 65541, 720917, 0, 131083, 786432, 0, 196616, 786433, 0, 196617, 786434, 0, 196617, 786435, 0, 196617, 786436, 0, 196617, 786437, 0, 196617, 786438, 0, 196617, 786439, 0, 196617, 786440, 0, 196617, 786441, 0, 196617, 786442, 0, 196617, 786443, 0, 196617, 786444, 0, 196617, 786445, 0, 196617, 786446, 0, 196617, 786447, 0, 196617, 786448, 0, 196617, 786449, 0, 196617, 786450, 0, 196617, 786451, 0, 196617, 786452, 0, 196617, 786453, 0, 196619 ) +tile_data = PoolIntArray( 65536, 0, 8, 65537, 0, 10, 65538, 0, 10, 65539, 0, 10, 65540, 0, 10, 65541, 0, 10, 65542, 0, 10, 65543, 0, 10, 65544, 0, 10, 65545, 0, 10, 65546, 0, 10, 65547, 0, 10, 65548, 0, 10, 65549, 0, 10, 65550, 0, 10, 65551, 0, 10, 65552, 0, 10, 65553, 0, 10, 65554, 0, 10, 65555, 0, 10, 65556, 0, 10, 65557, 0, 11, 131072, 0, 65544, 131073, 0, 131078, 131074, 0, 196617, 131075, 0, 196617, 131076, 0, 196617, 131077, 0, 196617, 131078, 0, 196617, 131079, 0, 196617, 131080, 0, 196617, 131081, 0, 196617, 131082, 0, 196617, 131083, 0, 196617, 131084, 0, 196617, 131085, 0, 196617, 131086, 0, 196617, 131087, 0, 196617, 131088, 0, 196617, 131089, 0, 196617, 131090, 0, 196617, 131091, 0, 196617, 131092, 0, 131077, 131093, 0, 131083, 196608, 0, 65544, 196609, 0, 131083, 196628, 0, 65544, 196629, 0, 131083, 262144, 0, 65544, 262145, 0, 131083, 262164, 0, 65544, 262165, 0, 131083, 327680, 0, 65544, 327681, 0, 131083, 327700, 0, 65544, 327701, 0, 131083, 393216, 0, 65544, 393217, 0, 131083, 393236, 0, 65544, 393237, 0, 131083, 458752, 0, 65544, 458753, 0, 131083, 458772, 0, 65544, 458773, 0, 131083, 524288, 0, 65544, 524289, 0, 131083, 524308, 0, 65544, 524309, 0, 131083, 589824, 0, 65544, 589825, 0, 131083, 589844, 0, 65544, 589845, 0, 131083, 655360, 0, 65544, 655361, 0, 131083, 655380, 0, 65544, 655381, 0, 131083, 720896, 0, 65544, 720897, 0, 65542, 720898, 0, 10, 720899, 0, 10, 720900, 0, 10, 720901, 0, 10, 720902, 0, 10, 720903, 0, 10, 720904, 0, 10, 720905, 0, 10, 720906, 0, 10, 720907, 0, 10, 720908, 0, 10, 720909, 0, 10, 720910, 0, 10, 720911, 0, 10, 720912, 0, 10, 720913, 0, 10, 720914, 0, 10, 720915, 0, 10, 720916, 0, 65541, 720917, 0, 131083, 786432, 0, 196616, 786433, 0, 196617, 786434, 0, 196617, 786435, 0, 196617, 786436, 0, 196617, 786437, 0, 196617, 786438, 0, 196617, 786439, 0, 196617, 786440, 0, 196617, 786441, 0, 196617, 786442, 0, 196617, 786443, 0, 196617, 786444, 0, 196617, 786445, 0, 196617, 786446, 0, 196617, 786447, 0, 196617, 786448, 0, 196617, 786449, 0, 196617, 786450, 0, 196617, 786451, 0, 196617, 786452, 0, 196617, 786453, 0, 196619 ) diff --git a/magic/Wands/BasicWand.tscn b/magic/Wands/BasicWand.tscn new file mode 100644 index 0000000..8eed803 --- /dev/null +++ b/magic/Wands/BasicWand.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://art/Wand.png" type="Texture" id=1] +[ext_resource path="res://script/BasicWand.gd" type="Script" id=2] + +[node name="Wand" type="Sprite"] +position = Vector2( 7, 0 ) +rotation = 1.5708 +texture = ExtResource( 1 ) +script = ExtResource( 2 ) + +[node name="ProjectileSpawn" type="Position2D" parent="."] +position = Vector2( -6.11959e-007, -7 ) + +[node name="ShootDelay" type="Timer" parent="."] +wait_time = 0.3 +one_shot = true diff --git a/meta/BoundedCamera.tscn b/meta/BoundedCamera.tscn index 35cc138..a45eeff 100644 --- a/meta/BoundedCamera.tscn +++ b/meta/BoundedCamera.tscn @@ -2,7 +2,7 @@ [ext_resource path="res://script/player camera.gd" type="Script" id=1] -[node name="Node2D" type="Camera2D"] +[node name="Camera2D" type="Camera2D"] script = ExtResource( 1 ) [node name="Tween" type="Tween" parent="."] diff --git a/project.godot b/project.godot index 749e406..bd25f24 100644 --- a/project.godot +++ b/project.godot @@ -116,6 +116,19 @@ shoot={ ] } +<<<<<<< HEAD +======= +[layer_names] + +2d_render/layer_1="Player" +2d_physics/layer_1="Player" +2d_render/layer_2="World" +2d_physics/layer_2="World" +2d_physics/layer_3="Enemy" +2d_physics/layer_4="Projectiles" + +>>>>>>> master [rendering] +quality/driver/fallback_to_gles2=true environment/default_environment="res://default_env.tres" diff --git a/script/BasicWand.gd b/script/BasicWand.gd new file mode 100644 index 0000000..90050cf --- /dev/null +++ b/script/BasicWand.gd @@ -0,0 +1,18 @@ +extends Sprite + +onready var ShootDelay : Timer = $ShootDelay +onready var ProjectileSpawn : Timer = $ProjectileSpawn +onready var Player = get_parent().get_parent() + +export var projectile_ps = globals.WHITE_PROJECTILE_PS + +func fire_projectile(rot): + if ShootDelay.is_stopped() and Player.energy != 0: + Player.Stats.interrupt_regen() + Player.energy -= 1 + var temp = projectile_ps.instance() + get_tree().current_scene.add_child(temp) + temp.global_position = ProjectileSpawn.global_position + temp.rotation_degrees = rot + temp.launch() + ShootDelay.start() \ No newline at end of file diff --git a/script/Projectile.gd b/script/Projectile.gd index bc29e5c..1a8f913 100644 --- a/script/Projectile.gd +++ b/script/Projectile.gd @@ -7,11 +7,10 @@ var velocity = Vector2.ZERO func _physics_process(delta): var collision = move_and_collide(velocity * delta) if collision != null: - on_impact() + on_impact(collision) func launch(): velocity = (Vector2(speed, 0)).rotated(rotation) - print(velocity) -func on_impact(): +func on_impact(collision): queue_free() diff --git a/script/player camera.gd b/script/player camera.gd index 2bcfc9a..83b5d4b 100644 --- a/script/player camera.gd +++ b/script/player camera.gd @@ -8,6 +8,7 @@ const SHIFT_DURATIOIN = .5 var facing = 0 var prev_facing = facing + onready var prev_pos = get_camera_position() onready var tween: Tween = $Tween onready var parent = get_parent() @@ -20,10 +21,10 @@ func set_limits(): var tilemap: TileMap = get_tree().get_nodes_in_group("Tilemap")[0] var map_limits = tilemap.get_used_rect() var map_cellsize = tilemap.cell_size - limit_left = (map_limits.position.x + 1) * map_cellsize.x - limit_right = (map_limits.end.x - 1) * map_cellsize.x - 1 - limit_top = (map_limits.position.y + 1) * map_cellsize.y - limit_bottom = (map_limits.end.y - 1) * map_cellsize.y + limit_left = (map_limits.position.x + 0.5) * map_cellsize.x + limit_right = (map_limits.end.x - 0.5) * map_cellsize.x - 1 + limit_top = (map_limits.position.y + 0.5) * map_cellsize.y + limit_bottom = (map_limits.end.y - 0.5) * map_cellsize.y func _process(delta): diff --git a/script/player.gd b/script/player.gd index 3bd8443..598b170 100644 --- a/script/player.gd +++ b/script/player.gd @@ -1,6 +1,8 @@ extends KinematicBody2D signal grounded_updated(is_grounded) +signal health_updated(new_health) +signal energy_updated(new_energy) var velocity = Vector2() var input_direction: int = 0 @@ -15,7 +17,6 @@ var walljump_height = 2.25 * 16 var jump_duration = 0.35 var is_grounded var touching_wall = 0 -var projectile_ps = globals.WHITE_PROJECTILE_PS onready var Spr: Sprite = $Sprite onready var Occluder: LightOccluder2D = $Sprite/LightOccluder2D @@ -25,8 +26,24 @@ onready var ShootDelay: Timer = $ShootDelay onready var StateMachine: Node = $PlayerStateMachine onready var HoldPosition: Node2D = $HoldPosition onready var ProjectileSpawn: Node2D = $HoldPosition/ProjectileSpawn +onready var Wand: Sprite = $HoldPosition/Wand +onready var Stats = $Stats +onready var health = Stats.health setget set_health, get_health +onready var energy = Stats.energy setget set_energy, get_energy +func set_health(value): + Stats.set_health(value) + +func get_health(): + return Stats.get_health() + +func set_energy(value): + Stats.set_energy(value) + +func get_energy(): + return Stats.get_energy() + func _ready(): gravity = 2 * max_jump_height / pow(jump_duration, 2) @@ -43,10 +60,9 @@ func handle_move_input(): input_direction = int(Input.is_action_pressed("right")) - int(Input.is_action_pressed("left")) velocity.x = lerp(velocity.x, speed * input_direction, get_movement_weight()) HoldPosition.look_at(get_global_mouse_position()) - HoldPosition.rotation_degrees - if Input.is_action_just_pressed("shoot"): - fire_projectile() + if Input.is_action_pressed("shoot"): + Wand.fire_projectile(HoldPosition.rotation_degrees) if input_direction > 0: Spr.flip_h = false @@ -60,14 +76,7 @@ func jump(): velocity.y = max_jump_velocity CoyoteTimer.stop() -func fire_projectile(): - if ShootDelay.is_stopped(): - var temp = projectile_ps.instance() - get_tree().current_scene.add_child(temp) - temp.global_position = ProjectileSpawn.global_position - temp.rotation_degrees = HoldPosition.rotation_degrees - temp.launch() - ShootDelay.start() + func apply_gravity(delta, modifier = 1): velocity.y += gravity * delta * modifier diff --git a/ui/Energy.aseprite b/ui/Energy.aseprite new file mode 100644 index 0000000..b096ec8 Binary files /dev/null and b/ui/Energy.aseprite differ diff --git a/ui/Energy.png b/ui/Energy.png new file mode 100644 index 0000000..7c0b57a Binary files /dev/null and b/ui/Energy.png differ diff --git a/ui/Energy.png.import b/ui/Energy.png.import new file mode 100644 index 0000000..b6fec78 --- /dev/null +++ b/ui/Energy.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Energy.png-ac8833c68f09dbcb97a2c6bd2d8b5d95.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/Energy.png" +dest_files=[ "res://.import/Energy.png-ac8833c68f09dbcb97a2c6bd2d8b5d95.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=false +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=false +svg/scale=1.0 diff --git a/ui/Hearts.png b/ui/Hearts.png new file mode 100644 index 0000000..372e8d3 Binary files /dev/null and b/ui/Hearts.png differ diff --git a/ui/Hearts.png.import b/ui/Hearts.png.import new file mode 100644 index 0000000..e2220d3 --- /dev/null +++ b/ui/Hearts.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Hearts.png-6a307803ebebd2819859201895084a12.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/Hearts.png" +dest_files=[ "res://.import/Hearts.png-6a307803ebebd2819859201895084a12.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=false +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=false +svg/scale=1.0 diff --git a/ui/Player UI Frame.png b/ui/Player UI Frame.png new file mode 100644 index 0000000..6bd1188 Binary files /dev/null and b/ui/Player UI Frame.png differ diff --git a/ui/Player UI Frame.png.import b/ui/Player UI Frame.png.import new file mode 100644 index 0000000..68e0190 --- /dev/null +++ b/ui/Player UI Frame.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Player UI Frame.png-919983870fbb940a7a6c9c573e72660f.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/Player UI Frame.png" +dest_files=[ "res://.import/Player UI Frame.png-919983870fbb940a7a6c9c573e72660f.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=false +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=false +svg/scale=1.0 diff --git a/ui/PlayerStats.gd b/ui/PlayerStats.gd new file mode 100644 index 0000000..3dad944 --- /dev/null +++ b/ui/PlayerStats.gd @@ -0,0 +1,30 @@ +extends CanvasLayer + +onready var Hearts: TextureProgress = $"Player UI Frame/Hearts" +onready var Energybar: TextureProgress = $"Player UI Frame/Energy" +onready var Regen: Timer = $Regen + +var health = 3 setget set_health, get_health +var energy = 0 setget set_energy, get_energy + +func _on_Regen_timeout(): + set_energy(get_energy() + 1) + +func _process(delta): + if get_energy() < Energybar.max_value and Regen.is_stopped(): + Regen.start() + +func set_health(value): + Hearts.value = clamp(value, Hearts.min_value, Hearts.max_value) + +func get_health(): + return Hearts.value + +func set_energy(value): + Energybar.value = clamp(value, Energybar.min_value, Energybar.max_value) + +func get_energy(): + return Energybar.value + +func interrupt_regen(): + Regen.start() diff --git a/ui/PlayerStats.tscn b/ui/PlayerStats.tscn new file mode 100644 index 0000000..3e04d88 --- /dev/null +++ b/ui/PlayerStats.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://ui/PlayerStats.gd" type="Script" id=1] +[ext_resource path="res://ui/Player UI Frame.png" type="Texture" id=2] +[ext_resource path="res://ui/Hearts.png" type="Texture" id=3] +[ext_resource path="res://ui/Energy.png" type="Texture" id=4] + +[node name="Stats" type="CanvasLayer"] +script = ExtResource( 1 ) + +[node name="Player UI Frame" type="Sprite" parent="."] +position = Vector2( 160, 171 ) +texture = ExtResource( 2 ) + +[node name="Hearts" type="TextureProgress" parent="Player UI Frame"] +margin_left = -45.0 +margin_top = -6.0 +margin_right = 2.0 +margin_bottom = 6.0 +max_value = 3.0 +step = 0.5 +value = 3.0 +texture_progress = ExtResource( 3 ) + +[node name="Energy" type="TextureProgress" parent="Player UI Frame"] +margin_left = 6.0 +margin_top = -5.0 +margin_right = 44.0 +margin_bottom = 4.0 +max_value = 5.0 +texture_progress = ExtResource( 4 ) + +[node name="Regen" type="Timer" parent="."] +wait_time = 0.5 +one_shot = true +[connection signal="timeout" from="Regen" to="." method="_on_Regen_timeout"]