camera now has scroll direction toggles
This commit is contained in:
parent
48cc1d43d6
commit
c60375cb98
11 changed files with 202 additions and 70 deletions
|
@ -0,0 +1,3 @@
|
|||
source_md5="f525d445e4ed5980188f7ea6b568dd05"
|
||||
dest_md5="f5d17549b4206c565ccce1e105ecba3c"
|
||||
|
Binary file not shown.
BIN
graphics/turniwood/turniwood_yellow.png
Normal file
BIN
graphics/turniwood/turniwood_yellow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 188 B |
35
graphics/turniwood/turniwood_yellow.png.import
Normal file
35
graphics/turniwood/turniwood_yellow.png.import
Normal file
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/turniwood_yellow.png-daf009113c5daf504d58a9354a706f88.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://graphics/turniwood/turniwood_yellow.png"
|
||||
dest_files=[ "res://.import/turniwood_yellow.png-daf009113c5daf504d58a9354a706f88.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
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
132
maps/map01.tscn
132
maps/map01.tscn
File diff suppressed because one or more lines are too long
|
@ -4,6 +4,9 @@ onready var resolution = Game.resolution
|
|||
onready var player = get_parent().get_node("Player")
|
||||
onready var current_sector = (player.global_position / resolution).floor()
|
||||
onready var last_sector = current_sector
|
||||
#Scroll direction
|
||||
export var scroll_h = true
|
||||
export var scroll_v = false
|
||||
|
||||
func _ready():
|
||||
set_as_toplevel(true)
|
||||
|
@ -13,7 +16,8 @@ func _process(delta):
|
|||
#Scroll screen when player is on different sector
|
||||
current_sector = (player.global_position / resolution).floor()
|
||||
if current_sector != last_sector:
|
||||
position = current_sector * resolution
|
||||
if scroll_h: position.x = current_sector.x * resolution.x
|
||||
if scroll_v: position.y = current_sector.y * resolution.y
|
||||
last_sector = current_sector
|
||||
Game.current_sector = current_sector
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ script = ExtResource( 2 )
|
|||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
material = SubResource( 7 )
|
||||
position = Vector2( 2, 2 )
|
||||
position = Vector2( 5, 2 )
|
||||
rotation = -1.5708
|
||||
texture = ExtResource( 3 )
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ extents = Vector2( 5, 5 )
|
|||
[node name="Bat" type="Node2D"]
|
||||
script = ExtResource( 3 )
|
||||
can_be_killed_by_sword = false
|
||||
score_for_killing = 25
|
||||
speed = 40
|
||||
move_direction = 1
|
||||
flip_sprite = false
|
||||
|
@ -38,6 +39,7 @@ flip_sprite = false
|
|||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
material = SubResource( 1 )
|
||||
frames = SubResource( 4 )
|
||||
frame = 1
|
||||
playing = true
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
|
|
@ -1,13 +1,23 @@
|
|||
extends Node2D
|
||||
onready var anims = $AnimationPlayer
|
||||
onready var timer = $Timer
|
||||
export var time:float = 60
|
||||
export(int, "Wood", "Yellow") var color
|
||||
onready var time_frames = time * 0.0166666666666667 # Time is converted from ms to frames @ 60fps
|
||||
|
||||
func _ready():
|
||||
#Autostart animationplayer
|
||||
anims.play("idle")
|
||||
timer.set_wait_time(time_frames)
|
||||
timer.start()
|
||||
|
||||
|
||||
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||
#When idling is done, turn
|
||||
if anim_name == "idle":
|
||||
anims.play("turn")
|
||||
#Return to idle after turn animation
|
||||
if anim_name == "turn":
|
||||
anims.play("idle")
|
||||
timer.set_wait_time(time_frames)
|
||||
|
||||
|
||||
func _on_Timer_timeout():
|
||||
anims.play("turn")
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://objects/turniwood/turniwood.gd" type="Script" id=1]
|
||||
[ext_resource path="res://graphics/turniwood/turniwood.png" type="Texture" id=2]
|
||||
[ext_resource path="res://graphics/turniwood/turniwood_yellow.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 4, 1 )
|
||||
|
||||
[sub_resource type="Animation" id=2]
|
||||
resource_name = "idle"
|
||||
loop = true
|
||||
step = 0.125
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("StaticBody2D/CollisionShape2D:disabled")
|
||||
tracks/0/path = NodePath("Sprite:region_rect")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
|
@ -19,22 +20,22 @@ tracks/0/keys = {
|
|||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ false ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Sprite:region_rect")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ Rect2( 0, 0, 8, 8 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Sprite:rotation_degrees")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ 0.0 ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Sprite:rotation_degrees")
|
||||
tracks/2/path = NodePath("StaticBody2D/CollisionShape2D:disabled")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
|
@ -43,12 +44,12 @@ tracks/2/keys = {
|
|||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ 0.0 ]
|
||||
"values": [ false ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=3]
|
||||
resource_name = "turn"
|
||||
length = 0.625
|
||||
length = 0.375
|
||||
step = 0.125
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("StaticBody2D/CollisionShape2D:disabled")
|
||||
|
@ -57,10 +58,10 @@ tracks/0/loop_wrap = true
|
|||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.125, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ false, true, false ]
|
||||
"values": [ true ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Sprite:region_rect")
|
||||
|
@ -69,10 +70,10 @@ tracks/1/loop_wrap = true
|
|||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.125, 0.25, 0.375, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
|
||||
"times": PoolRealArray( 0, 0.125, 0.25 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ Rect2( 0, 0, 8, 8 ), Rect2( 8, 0, 8, 8 ), Rect2( 0, 0, 8, 8 ), Rect2( 8, 0, 8, 8 ), Rect2( 0, 0, 8, 8 ) ]
|
||||
"values": [ Rect2( 8, 0, 8, 8 ), Rect2( 0, 0, 8, 8 ), Rect2( 8, 0, 8, 8 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Sprite:rotation_degrees")
|
||||
|
@ -81,10 +82,10 @@ tracks/2/loop_wrap = true
|
|||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0, 0.125, 0.25, 0.375, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
|
||||
"times": PoolRealArray( 0, 0.125, 0.25 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ 0.0, 90.0, 90.0, 0.0, 0.0 ]
|
||||
"values": [ 90.0, 90.0, 0.0 ]
|
||||
}
|
||||
|
||||
[node name="Turniwood" type="Node2D"]
|
||||
|
@ -106,4 +107,7 @@ shape = SubResource( 1 )
|
|||
anims/idle = SubResource( 2 )
|
||||
anims/turn = SubResource( 3 )
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
|
||||
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"]
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_resource type="TileSet" load_steps=18 format=2]
|
||||
[gd_resource type="TileSet" load_steps=16 format=2]
|
||||
|
||||
[ext_resource path="res://graphics/tiles/grass.png" type="Texture" id=1]
|
||||
|
||||
|
@ -29,15 +29,9 @@ points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
|
|||
[sub_resource type="ConvexPolygonShape2D" id=9]
|
||||
points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=10]
|
||||
points = PoolVector2Array( 8, 5, 0, 5, 0, 8, 8, 8 )
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=11]
|
||||
points = PoolVector2Array( 8, 0, 8, 0, 8, 0, 8, 0 )
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=12]
|
||||
points = PoolVector2Array( 8, 0, 8, 0, 8, 8, 8, 8 )
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=13]
|
||||
points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
|
||||
|
||||
|
@ -126,12 +120,6 @@ points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
|
|||
"shape": SubResource( 9 ),
|
||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
}, {
|
||||
"autotile_coord": Vector2( 3, 0 ),
|
||||
"one_way": false,
|
||||
"one_way_margin": 1.0,
|
||||
"shape": SubResource( 10 ),
|
||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
}, {
|
||||
"autotile_coord": Vector2( 2, 0 ),
|
||||
"one_way": false,
|
||||
"one_way_margin": 1.0,
|
||||
|
@ -141,12 +129,6 @@ points = PoolVector2Array( 8, 8, 0, 8, 0, 0, 8, 0 )
|
|||
"autotile_coord": Vector2( 2, 0 ),
|
||||
"one_way": false,
|
||||
"one_way_margin": 1.0,
|
||||
"shape": SubResource( 12 ),
|
||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
}, {
|
||||
"autotile_coord": Vector2( 2, 0 ),
|
||||
"one_way": false,
|
||||
"one_way_margin": 1.0,
|
||||
"shape": SubResource( 13 ),
|
||||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
}, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue