-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09ca3cf
commit b16fbd6
Showing
11 changed files
with
176 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://25aj8wr271hw" | ||
path="res://.godot/imported/laserRed01.png-5a5873855acc43ef628a72927c9f1245.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://images/laserRed01.png" | ||
dest_files=["res://.godot/imported/laserRed01.png-5a5873855acc43ef628a72927c9f1245.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
extends Area2D | ||
var speed = 501 | ||
var dir | ||
var muzzle | ||
|
||
# Called when the node enters the scene tree for the first time. | ||
func _ready(): | ||
self.global_position = muzzle | ||
global_rotation = dir.angle() | ||
|
||
func setup(direction, muzzlePos): | ||
dir = direction | ||
muzzle = muzzlePos | ||
|
||
# Called every frame. 'delta' is the elapsed time since the previous frame. | ||
func _process(delta): | ||
position += dir * speed * delta | ||
print(position) | ||
|
||
func _on_body_entered(body): | ||
if body.is_in_group("enemy"): | ||
body.queue_free() | ||
if !body.is_in_group("player"): | ||
queue_free() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[gd_scene load_steps=4 format=3 uid="uid://boqn5yw22tcj7"] | ||
|
||
[ext_resource type="Texture2D" uid="uid://cooutieukq5fx" path="res://scenes/laserRed01.png" id="1_4l3sk"] | ||
[ext_resource type="Script" path="res://scenes/bullet.gd" id="1_qyq4p"] | ||
|
||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cn71r"] | ||
size = Vector2(57, 10) | ||
|
||
[node name="Bullet" type="Area2D"] | ||
script = ExtResource("1_qyq4p") | ||
|
||
[node name="Sprite2D" type="Sprite2D" parent="."] | ||
rotation = 1.5708 | ||
texture = ExtResource("1_4l3sk") | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] | ||
position = Vector2(-2.5, 0) | ||
shape = SubResource("RectangleShape2D_cn71r") | ||
|
||
[connection signal="body_entered" from="." to="." method="_on_body_entered"] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://cooutieukq5fx" | ||
path="res://.godot/imported/laserRed01.png-b302d850d42954e1f780d8ff592eed6a.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://scenes/laserRed01.png" | ||
dest_files=["res://.godot/imported/laserRed01.png-b302d850d42954e1f780d8ff592eed6a.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
extends CharacterBody2D | ||
|
||
const bullet_scene = preload("res://scenes/bullet.tscn") | ||
const SPEED = 300.0 | ||
const JUMP_VELOCITY = -400.0 | ||
|
||
# Get the gravity from the project settings to be synced with RigidBody nodes. | ||
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") | ||
|
||
|
||
func _physics_process(delta): | ||
# Add the gravity. | ||
if not is_on_floor(): | ||
velocity.y += gravity * delta | ||
|
||
# Handle jump. | ||
if Input.is_action_just_pressed("ui_accept") and is_on_floor(): | ||
velocity.y = JUMP_VELOCITY | ||
|
||
# Get the input direction and handle the movement/deceleration. | ||
# As good practice, you should replace UI actions with custom gameplay actions. | ||
var direction = Input.get_axis("ui_left", "ui_right") | ||
if direction: | ||
velocity.x = direction * SPEED | ||
else: | ||
velocity.x = move_toward(velocity.x, 0, SPEED) | ||
|
||
move_and_slide() | ||
|
||
if Input.is_action_just_pressed("shoot"): | ||
print("pew pew") | ||
shoot() | ||
|
||
|
||
func shoot(): | ||
var b = bullet_scene.instantiate() | ||
var direction = (get_global_mouse_position() - global_position).normalized() | ||
b.setup(direction, $Marker2D.global_position) | ||
owner.add_child(b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters