Spaceship has been done
This commit is contained in:
commit
35b88f837b
|
@ -0,0 +1,9 @@
|
|||
# Godot-specific ignores
|
||||
.import/
|
||||
export.cfg
|
||||
export_presets.cfg
|
||||
|
||||
# Mono-specific ignores
|
||||
.mono/
|
||||
data_*/
|
||||
*~
|
|
@ -0,0 +1,6 @@
|
|||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
|
||||
[resource]
|
||||
background_sky = SubResource( 1 )
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.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=true
|
||||
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=true
|
||||
svg/scale=1.0
|
Binary file not shown.
After Width: | Height: | Size: 359 B |
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/asteroid_grey.png-8dc4d6f97bc2cff97dcb90e982bc3460.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://images/asteroid_grey.png"
|
||||
dest_files=[ "res://.import/asteroid_grey.png-8dc4d6f97bc2cff97dcb90e982bc3460.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=true
|
||||
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=true
|
||||
svg/scale=1.0
|
Binary file not shown.
After Width: | Height: | Size: 623 B |
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/asteroid_grey_tiny.png-193f065c369845d128bbc29aebc466dc.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://images/asteroid_grey_tiny.png"
|
||||
dest_files=[ "res://.import/asteroid_grey_tiny.png-193f065c369845d128bbc29aebc466dc.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=true
|
||||
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=true
|
||||
svg/scale=1.0
|
Binary file not shown.
After Width: | Height: | Size: 585 B |
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/asteroid_tiny.png-ffeeb3d6ad46f56e166f43c37735ea56.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://images/asteroid_tiny.png"
|
||||
dest_files=[ "res://.import/asteroid_tiny.png-ffeeb3d6ad46f56e166f43c37735ea56.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=true
|
||||
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=true
|
||||
svg/scale=1.0
|
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/background-red.png-cfd79b18e6744e1b1528eaa92dd95c53.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://images/background-red.png"
|
||||
dest_files=[ "res://.import/background-red.png-cfd79b18e6744e1b1528eaa92dd95c53.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=true
|
||||
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=true
|
||||
svg/scale=1.0
|
Binary file not shown.
After Width: | Height: | Size: 635 B |
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/pixel_asteroid.png-4c8492b5959058b49bb7cde80113cd5e.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://images/pixel_asteroid.png"
|
||||
dest_files=[ "res://.import/pixel_asteroid.png-4c8492b5959058b49bb7cde80113cd5e.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=true
|
||||
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=true
|
||||
svg/scale=1.0
|
Binary file not shown.
After Width: | Height: | Size: 358 B |
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/pixel_ship_red.png-cc824bfd01a377152c43f409da7b4c36.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://images/pixel_ship_red.png"
|
||||
dest_files=[ "res://.import/pixel_ship_red.png-cc824bfd01a377152c43f409da7b4c36.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=true
|
||||
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=true
|
||||
svg/scale=1.0
|
|
@ -0,0 +1,32 @@
|
|||
; 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=4
|
||||
|
||||
_global_script_classes=[ ]
|
||||
_global_script_class_icons={
|
||||
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="space_escape"
|
||||
run/main_scene="res://scenes/Main.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[input]
|
||||
|
||||
click={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_environment="res://default_env.tres"
|
|
@ -0,0 +1,34 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://images/pixel_asteroid.png" type="Texture" id=1]
|
||||
[ext_resource path="res://images/asteroid_grey.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 1 ) ],
|
||||
"loop": false,
|
||||
"name": "yellow",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 2 ) ],
|
||||
"loop": true,
|
||||
"name": "grey",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="CircleShape2D" id=2]
|
||||
radius = 30.0
|
||||
|
||||
[node name="BigAstroid" type="RigidBody2D"]
|
||||
gravity_scale = 0.0
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
scale = Vector2( 0.75, 0.75 )
|
||||
frames = SubResource( 1 )
|
||||
animation = "grey"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 2 )
|
|
@ -0,0 +1,26 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://images/background-red.png" type="Texture" id=1]
|
||||
[ext_resource path="res://scenes/Player.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://scenes/BigAstroid.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="Main" type="Node"]
|
||||
|
||||
[node name="background" type="ParallaxBackground" parent="."]
|
||||
|
||||
[node name="ParallaxLayer" type="ParallaxLayer" parent="background"]
|
||||
|
||||
[node name="background-red" type="Sprite" parent="background/ParallaxLayer"]
|
||||
position = Vector2( 390, 211 )
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource( 2 )]
|
||||
position = Vector2( 490, 190 )
|
||||
|
||||
[node name="StartPosition" type="Position2D" parent="."]
|
||||
|
||||
[node name="BigAstroid" parent="." instance=ExtResource( 3 )]
|
||||
position = Vector2( 350, 220 )
|
||||
|
||||
[node name="TileMap" type="TileMap" parent="."]
|
||||
format = 1
|
|
@ -0,0 +1,69 @@
|
|||
extends RigidBody2D
|
||||
|
||||
# How fast the player will move (pixels/sec).
|
||||
export var speed = 400
|
||||
|
||||
# The force constant
|
||||
# TODO: replace this with a dynamic force from the length of the drag
|
||||
export var force = 0.2
|
||||
|
||||
# Size of the game window.
|
||||
var screen_size
|
||||
|
||||
# A boolean that indicates whether users is dragging their
|
||||
# touch or not
|
||||
var dragging
|
||||
|
||||
# The drag starting vector
|
||||
var drag_start = Vector2()
|
||||
|
||||
# Signals
|
||||
signal hit
|
||||
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed('click') and not dragging:
|
||||
dragging = true
|
||||
drag_start = get_global_mouse_position()
|
||||
|
||||
if event.is_action_released('click') and dragging:
|
||||
dragging = false
|
||||
var drag_end = get_global_mouse_position()
|
||||
var direction = drag_end - drag_start
|
||||
|
||||
# if direction.y > 0:
|
||||
# $Ship.flip_v = true
|
||||
# else:
|
||||
# $Ship.flip_v = false
|
||||
|
||||
# var angle = ($FrontPosition.position.normalized() - $CenterPosition.position.normalized()).dot(drag_end.normalized())
|
||||
# var torque = ($FrontPosition.position - $CenterPosition.position).angle_to(drag_end)
|
||||
# print(torque)
|
||||
# print(angle)
|
||||
# print("-----")
|
||||
apply_impulse(position.normalized(), direction * force)
|
||||
# apply_torque_impulse(torque * -100)
|
||||
# #$Ship.rotate(torque)
|
||||
|
||||
func _ready():
|
||||
# hide()
|
||||
screen_size = get_viewport_rect().size
|
||||
|
||||
|
||||
func _process(delta):
|
||||
if linear_velocity.y > 0:
|
||||
$Ship.flip_v = true
|
||||
else:
|
||||
$Ship.flip_v = false
|
||||
|
||||
|
||||
func _on_Player_body_entered(body):
|
||||
hide()
|
||||
emit_signal('hit')
|
||||
$CollisionShape2D.set_deferred('disabled', true)
|
||||
|
||||
|
||||
func start(pos):
|
||||
position = pos
|
||||
show()
|
||||
$CollisionShape2D.disabled = false
|
|
@ -0,0 +1,39 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/Player.gd" type="Script" id=1]
|
||||
[ext_resource path="res://images/pixel_ship_red.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=2]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 2 ) ],
|
||||
"loop": true,
|
||||
"name": "idle",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=1]
|
||||
points = PoolVector2Array( -40, 30, 0, -40, 40, 30, 10, 40, -10, 40 )
|
||||
|
||||
[node name="Player" type="RigidBody2D"]
|
||||
position = Vector2( 0, -1 )
|
||||
gravity_scale = 0.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_horizontal_guides_": [ 40.0, -40.0, 20.0 ],
|
||||
"_edit_vertical_guides_": [ -40.0, 40.0 ]
|
||||
}
|
||||
|
||||
[node name="FrontPosition" type="Position2D" parent="."]
|
||||
position = Vector2( 0, -39 )
|
||||
|
||||
[node name="CenterPosition" type="Position2D" parent="."]
|
||||
position = Vector2( 0, 21 )
|
||||
|
||||
[node name="Ship" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( 0, 21 )
|
||||
frames = SubResource( 2 )
|
||||
animation = "idle"
|
||||
offset = Vector2( 0, -25 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
Loading…
Reference in New Issue