add the things.

This commit is contained in:
Robin Hübner 2017-08-04 20:53:05 +02:00
parent 3d46eab5c3
commit 3524712b6f
20 changed files with 34 additions and 20 deletions

View File

@ -1,18 +1,19 @@
[gd_scene load_steps=4 format=1]
[ext_resource path="res://Asteroid.gd" type="Script" id=1]
[ext_resource path="res://raw/asteroid.png" type="Texture" id=2]
[ext_resource path="res://raw/asteroid_small.png" type="Texture" id=2]
[sub_resource type="RectangleShape2D" id=1]
custom_solver_bias = 0.0
extents = Vector2( 25.1672, 26.3172 )
extents = Vector2( 12.234, 13.1952 )
[node name="Asteroid" type="KinematicBody2D"]
transform/scale = Vector2( 2, 2 )
input/pickable = false
shapes/0/shape = SubResource( 1 )
shapes/0/transform = Matrix32( 1, 0, 0, 1, -0.17482, 3.67132 )
shapes/0/transform = Matrix32( 1, 0, 0, 1, -0.17482, 1.87222 )
shapes/0/trigger = false
collision/layers = 1
collision/mask = 1
@ -25,7 +26,7 @@ texture = ExtResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
transform/pos = Vector2( -0.17482, 3.67132 )
transform/pos = Vector2( -0.17482, 1.87222 )
shape = SubResource( 1 )
trigger = false
_update_shape_index = 0

View File

@ -10,6 +10,7 @@ extents = Vector2( 0.99762, 3.98857 )
[node name="Bullet" type="KinematicBody2D"]
transform/rot = 180.0
input/pickable = false
shapes/0/shape = SubResource( 1 )
shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 )

View File

@ -69,5 +69,6 @@ region_rect = Rect2( 0, 0, 8192, 8192 )
[node name="EnemyGrunt" parent="." instance=ExtResource( 7 )]
transform/pos = Vector2( 127.878, -20.3627 )
transform/scale = Vector2( 1.5, 1.5 )

8
Gun.gd
View File

@ -4,18 +4,20 @@ var Bullet = load("res://Bullet.tscn")
var gun_cooldown = 0
var gun_delay = 0.1125
var gun_spread_max = deg2rad(1) # degrees max
func _ready():
set_fixed_process(true)
func _fixed_process(delta):
gun_cooldown = clamp(gun_cooldown - delta, 0, 1)
func fire(delta, vel, dir):
if gun_cooldown <= 0:
var new_bullet = Bullet.instance()
var gun_pos = get_global_pos()
new_bullet.set_pos(gun_pos + vel)
get_tree().get_root().add_child(new_bullet)
new_bullet.fire(delta, vel, dir, 512)
var rot = rand_range(-gun_spread_max, gun_spread_max)
new_bullet.fire(delta, vel, dir.rotated(rot), 512)
gun_cooldown += gun_delay

View File

@ -22,7 +22,7 @@ func _ready():
set_fixed_process(true)
left_particles.set_emitting(false)
right_particles.set_emitting(false)
func turn_towards(delta, pos):
var target_dir = (pos - get_global_pos()).normalized()
@ -45,12 +45,12 @@ func turn_towards(delta, pos):
right_particles.set_emitting(false)
ship_dir = ship_dir.rotated(-ca)
func _fixed_process(delta):
var mov_delta = Vector2(0, 0)
turn_towards(delta, get_global_mouse_pos())
if Input.is_action_pressed("player_move_forwards"):
is_moving = true
mov_delta += -ship_dir
@ -58,7 +58,7 @@ func _fixed_process(delta):
mov_delta += ship_dir
else:
is_moving = false
if Input.is_action_pressed("player_attack_primary"):
left_gun.fire(delta, ship_vel, -ship_dir)
right_gun.fire(delta, ship_vel, -ship_dir)

BIN
raw/asteroid.ase (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
raw/asteroid_medium.ase (Stored with Git LFS) Normal file

Binary file not shown.

BIN
raw/asteroid_medium.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,2 @@
filter=false
gen_mipmaps=false

BIN
raw/asteroid_small.ase (Stored with Git LFS) Normal file

Binary file not shown.

BIN
raw/asteroid_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

View File

@ -0,0 +1,2 @@
filter=false
gen_mipmaps=false

BIN
raw/enemy_grunt.ase (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 516 B

After

Width:  |  Height:  |  Size: 272 B

View File

@ -1,3 +1,2 @@
filter=false
gen_mipmaps=false
anisotropic=true

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8f3e61a8c2412de50a0148ec89a179462304b044ff39ee77a2dd70cdb4eb8a9f
size 990
oid sha256:a4ee2a229e536843a7614db4df999ffb22a4dd382176d4dd24a333870dcd8304
size 1047

Binary file not shown.

Before

Width:  |  Height:  |  Size: 751 B

After

Width:  |  Height:  |  Size: 820 B

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e527fef8ec783c4d0fe4da31c38011107940600b9db3df77621c815f35166e0a
size 578
oid sha256:4d43c431b9848d37f00b63f37a5f0a4a72b482591f925ffe609a723f6fe06ad5
size 552

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 B

After

Width:  |  Height:  |  Size: 110 B