added delta to camera movements
This commit is contained in:
parent
527b0c64f1
commit
a8b07fdbd9
61
.gitignore
vendored
61
.gitignore
vendored
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
# Created by https://www.toptal.com/developers/gitignore/api/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=godot,jetbrains,csharp,visualstudiocode
|
# Edit at https://www.toptal.com/developers/gitignore?templates=jetbrains+all,godot,csharp
|
||||||
|
|
||||||
### Csharp ###
|
### Csharp ###
|
||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
@ -413,7 +413,7 @@ export_presets.cfg
|
|||||||
.mono/
|
.mono/
|
||||||
data_*/
|
data_*/
|
||||||
|
|
||||||
### JetBrains ###
|
### JetBrains+all ###
|
||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
# 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
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
@ -492,49 +492,20 @@ fabric.properties
|
|||||||
# Android studio 3.1+ serialized cache file
|
# Android studio 3.1+ serialized cache file
|
||||||
.idea/caches/build_file_checksums.ser
|
.idea/caches/build_file_checksums.ser
|
||||||
|
|
||||||
### JetBrains Patch ###
|
### JetBrains+all Patch ###
|
||||||
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
# 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
|
.idea/*
|
||||||
# modules.xml
|
|
||||||
# .idea/misc.xml
|
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
|
||||||
# *.ipr
|
|
||||||
|
*.iml
|
||||||
|
modules.xml
|
||||||
|
.idea/misc.xml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
# Sonarlint plugin
|
# Sonarlint plugin
|
||||||
# https://plugins.jetbrains.com/plugin/7973-sonarlint
|
.idea/sonarlint
|
||||||
.idea/**/sonarlint/
|
|
||||||
|
|
||||||
# SonarQube Plugin
|
# End of https://www.toptal.com/developers/gitignore/api/jetbrains+all,godot,csharp
|
||||||
# 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
|
|
||||||
|
1
.idea/.idea.Particles/.idea/.name
generated
1
.idea/.idea.Particles/.idea/.name
generated
@ -1 +0,0 @@
|
|||||||
Particles
|
|
@ -58,26 +58,26 @@ public class ParticleSimulationScene : Node2D
|
|||||||
shouldTweenStop = true;
|
shouldTweenStop = true;
|
||||||
|
|
||||||
// Zoom
|
// Zoom
|
||||||
_cameraZoomTarget -= new Vector2(0.1f, 0.1f);
|
_cameraZoomTarget -= new Vector2(0.1f, 0.1f) * (delta * 60f);
|
||||||
|
|
||||||
// Movement
|
// Movement
|
||||||
var mousePos = GetGlobalMousePosition();
|
var mousePos = GetGlobalMousePosition();
|
||||||
var posDelta = _cameraPosTarget - mousePos;
|
var posDelta = _cameraPosTarget - mousePos;
|
||||||
posDelta = posDelta.Clamped(500f);
|
posDelta = posDelta.Clamped(500f);
|
||||||
_cameraPosTarget -= posDelta * 0.2f;
|
_cameraPosTarget -= posDelta * 0.2f * (delta * 60f);
|
||||||
}
|
}
|
||||||
if (Input.IsActionJustReleased("zoom_out"))
|
if (Input.IsActionJustReleased("zoom_out"))
|
||||||
{
|
{
|
||||||
shouldTweenStop = true;
|
shouldTweenStop = true;
|
||||||
|
|
||||||
// Zoom
|
// Zoom
|
||||||
_cameraZoomTarget += new Vector2(0.1f, 0.1f);
|
_cameraZoomTarget += new Vector2(0.1f, 0.1f) * (delta * 60f);
|
||||||
|
|
||||||
// Movement
|
// Movement
|
||||||
var mousePos = GetGlobalMousePosition();
|
var mousePos = GetGlobalMousePosition();
|
||||||
var posDelta = _cameraPosTarget - mousePos;
|
var posDelta = _cameraPosTarget - mousePos;
|
||||||
posDelta = posDelta.Clamped(500f);
|
posDelta = posDelta.Clamped(500f);
|
||||||
_cameraPosTarget += posDelta * 0.2f;
|
_cameraPosTarget += posDelta * 0.2f * (delta * 60f);
|
||||||
}
|
}
|
||||||
|
|
||||||
var cameraDir = new Vector2();
|
var cameraDir = new Vector2();
|
||||||
@ -101,13 +101,13 @@ public class ParticleSimulationScene : Node2D
|
|||||||
if (Input.IsActionPressed("key_zoom_in"))
|
if (Input.IsActionPressed("key_zoom_in"))
|
||||||
{
|
{
|
||||||
shouldTweenStop = true;
|
shouldTweenStop = true;
|
||||||
_cameraZoomTarget -= new Vector2(0.01f, 0.01f);
|
_cameraZoomTarget -= new Vector2(0.01f, 0.01f) * (delta * 60f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.IsActionPressed("key_zoom_out"))
|
if (Input.IsActionPressed("key_zoom_out"))
|
||||||
{
|
{
|
||||||
shouldTweenStop = true;
|
shouldTweenStop = true;
|
||||||
_cameraZoomTarget += new Vector2(0.01f, 0.01f);
|
_cameraZoomTarget += new Vector2(0.01f, 0.01f) * (delta * 60f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldTweenStop)
|
if (shouldTweenStop)
|
||||||
|
Loading…
Reference in New Issue
Block a user