godot - Cant unpause in godot
问题描述
I am making a game in godot. But I can't unpause after pausing. I used Input Map to create two keyboard shortcuts(one to pause and other to un-pause) and auto-loaded the script. This is the code:
extends Node
var players_coin = 0
func _ready():
PAUSE_MODE_PROCESS
func _input(event):
if Input.is_action_pressed("pause"):
get_tree().paused = true
if Input.is_action_pressed("unpause"):
get_tree().paused = false
I am bad at stack overflow, but this should work.
I am using "Godot 3.2.2.stable" and any help would be great.
解决方案
只需将您的就绪功能替换为以下内容:
func _ready():
pause_mode = Node.PAUSE_MODE_PROCESS
或者您可以在 Inspector Tab 下的 Node 中执行相同的操作。
推荐阅读
- reactjs - 在 svg 中嵌入 svg 的样式(在 Chrome 上)
- php - Laravel 7:尝试获取名称而不是 id
- angular - Angular 10.1 Ivy 不理解 *ngFor 指令
- next.js - create-next-app 不起作用,出现内部服务器错误
- postgresql - 通过 VPC 连接器连接 Google Cloud Platform 的计算引擎和应用引擎
- python - 使用 pybind11 将向量从 C++ 传递到 Python
- java - 无法识别 startActivityForResult 中的 int?
- arrays - 两个指针问题和滑动窗口一样吗
- python - Python Pandas set_index 函数:KeyError:“列中都没有 []”
- linux - 在编译和安装“ModSecurity-Nginx”模块时执行“make”命令时出错