added delta to camera movements

This commit is contained in:
orosmatthew 2022-02-07 10:54:59 -05:00
parent 527b0c64f1
commit a8b07fdbd9
3 changed files with 22 additions and 52 deletions

61
.gitignore vendored
View File

@ -1,6 +1,6 @@
# Created by https://www.toptal.com/developers/gitignore/api/godot,jetbrains,csharp,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=godot,jetbrains,csharp,visualstudiocode
# Created by https://www.toptal.com/developers/gitignore/api/jetbrains+all,godot,csharp
# Edit at https://www.toptal.com/developers/gitignore?templates=jetbrains+all,godot,csharp
### Csharp ###
## Ignore Visual Studio temporary files, build results, and
@ -413,7 +413,7 @@ export_presets.cfg
.mono/
data_*/
### JetBrains ###
### JetBrains+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
@ -492,49 +492,20 @@ fabric.properties
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### JetBrains Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
### JetBrains+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
.idea/*
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
*.iml
modules.xml
.idea/misc.xml
*.ipr
# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/
.idea/sonarlint
# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml
# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/
# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$
# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml
### VisualStudioCode ###
!.vscode/*.code-snippets
# Local History for Visual Studio Code
# Built Visual Studio Code Extensions
*.vsix
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
# Support for Project snippet scope
# End of https://www.toptal.com/developers/gitignore/api/godot,jetbrains,csharp,visualstudiocode
# End of https://www.toptal.com/developers/gitignore/api/jetbrains+all,godot,csharp

View File

@ -1 +0,0 @@
Particles

View File

@ -58,26 +58,26 @@ public class ParticleSimulationScene : Node2D
shouldTweenStop = true;
// Zoom
_cameraZoomTarget -= new Vector2(0.1f, 0.1f);
_cameraZoomTarget -= new Vector2(0.1f, 0.1f) * (delta * 60f);
// Movement
var mousePos = GetGlobalMousePosition();
var posDelta = _cameraPosTarget - mousePos;
posDelta = posDelta.Clamped(500f);
_cameraPosTarget -= posDelta * 0.2f;
_cameraPosTarget -= posDelta * 0.2f * (delta * 60f);
}
if (Input.IsActionJustReleased("zoom_out"))
{
shouldTweenStop = true;
// Zoom
_cameraZoomTarget += new Vector2(0.1f, 0.1f);
_cameraZoomTarget += new Vector2(0.1f, 0.1f) * (delta * 60f);
// Movement
var mousePos = GetGlobalMousePosition();
var posDelta = _cameraPosTarget - mousePos;
posDelta = posDelta.Clamped(500f);
_cameraPosTarget += posDelta * 0.2f;
_cameraPosTarget += posDelta * 0.2f * (delta * 60f);
}
var cameraDir = new Vector2();
@ -101,13 +101,13 @@ public class ParticleSimulationScene : Node2D
if (Input.IsActionPressed("key_zoom_in"))
{
shouldTweenStop = true;
_cameraZoomTarget -= new Vector2(0.01f, 0.01f);
_cameraZoomTarget -= new Vector2(0.01f, 0.01f) * (delta * 60f);
}
if (Input.IsActionPressed("key_zoom_out"))
{
shouldTweenStop = true;
_cameraZoomTarget += new Vector2(0.01f, 0.01f);
_cameraZoomTarget += new Vector2(0.01f, 0.01f) * (delta * 60f);
}
if (shouldTweenStop)