Compare commits

..

No commits in common. "3f75f5f4477b070ff0d91e1e07b897159419e65c" and "12e6d9b216c299cf57c654c6235caec291ceb1d0" have entirely different histories.

3 changed files with 1 additions and 63 deletions

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=2] [gd_scene load_steps=15 format=2]
[ext_resource path="res://Tilesets/stone.png" type="Texture" id=1] [ext_resource path="res://Tilesets/stone.png" type="Texture" id=1]
[ext_resource path="res://Tilesets/dirt.png" type="Texture" id=2] [ext_resource path="res://Tilesets/dirt.png" type="Texture" id=2]
@ -7,7 +7,6 @@
[ext_resource path="res://NPCs/ooze.tscn" type="PackedScene" id=5] [ext_resource path="res://NPCs/ooze.tscn" type="PackedScene" id=5]
[ext_resource path="res://NPCs/moss.tscn" type="PackedScene" id=6] [ext_resource path="res://NPCs/moss.tscn" type="PackedScene" id=6]
[ext_resource path="res://Audio/Background/cave.ogg" type="AudioStream" id=7] [ext_resource path="res://Audio/Background/cave.ogg" type="AudioStream" id=7]
[ext_resource path="res://camera.gd" type="Script" id=8]
[sub_resource type="ConvexPolygonShape2D" id=1] [sub_resource type="ConvexPolygonShape2D" id=1]
points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 ) points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 )
@ -137,13 +136,6 @@ points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 )
[node name="World" type="Node2D"] [node name="World" type="Node2D"]
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2( 40, 32 )
current = true
script = ExtResource( 8 )
[node name="Tween" type="Tween" parent="Camera2D"]
[node name="TileMap" type="TileMap" parent="."] [node name="TileMap" type="TileMap" parent="."]
tile_set = SubResource( 7 ) tile_set = SubResource( 7 )
cell_size = Vector2( 8, 8 ) cell_size = Vector2( 8, 8 )

View File

@ -1,41 +0,0 @@
extends Camera2D
# Lower cap for the `_zoom_level`.
export var min_zoom := 0.5
# Upper cap for the `_zoom_level`.
export var max_zoom := 2.0
# Controls how much we increase or decrease the `_zoom_level` on every turn of the scroll wheel.
export var zoom_factor := 0.1
# Duration of the zoom's tween animation.
export var zoom_duration := 0.2
# The camera's target zoom level.
var _zoom_level := 1.0 setget _set_zoom_level
# We store a reference to the scene's tween node.
onready var tween: Tween = $Tween
func _set_zoom_level(value: float) -> void:
# We limit the value between `min_zoom` and `max_zoom`
_zoom_level = clamp(value, min_zoom, max_zoom)
# Then, we ask the tween node to animate the camera's `zoom` property from its current value
# to the target zoom level.
tween.interpolate_property(
self,
"zoom",
zoom,
Vector2(_zoom_level, _zoom_level),
zoom_duration,
tween.TRANS_SINE,
# Easing out means we start fast and slow down as we reach the target value.
tween.EASE_OUT
)
tween.start()
func _unhandled_input(event):
if event.is_action_pressed("zoom_in"):
# Inside a given class, we need to either write `self._zoom_level = ...` or explicitly
# call the setter function to use it.
_set_zoom_level(_zoom_level - zoom_factor)
if event.is_action_pressed("zoom_out"):
_set_zoom_level(_zoom_level + zoom_factor)

View File

@ -37,19 +37,6 @@ window/stretch/mode="2d"
singletons=[ ] singletons=[ ]
[input]
zoom_in={
"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":4,"pressed":false,"doubleclick":false,"script":null)
]
}
zoom_out={
"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":5,"pressed":false,"doubleclick":false,"script":null)
]
}
[physics] [physics]
common/physics_fps=5 common/physics_fps=5