Godot01-初体验

Godot01-初体验

1-视频教程:https://www.bilibili.com/video/BV1ugKB66ExJ

2-项目仓库地址:https://gitee.com/enzoism/godot_demo_1

1-火柴人场景

  • 1-游戏坐标:x(向右为正)y(向下为正)

  • 2-创建Scene场景(类型:Node2D)

  • 3-创建物品(类型:Sprite2D)

  • 4-添加物品图盘(拖拽到右侧Texture图标中)

  • 5-物品无法直接修改大小(只能修改scale大小)

  • 6-尝试进行一个火柴人的拼装(父子节点组合)


2-gdscript初体验

1-gdscript官网文档:https://docs.godotengine.org/zh-cn/4.x/about/introduction.html

2-推荐直接点击doc跳转在线看指定版本

  • 1-创建Scene场景(类型:Node2D)
  • 2-创建gdscript脚本(gdscript一种针对godot的Script语言)
  • 3-创建物品(类型:Sprite2D)
  • 4-打印物品位置属性(测试:脚本和物品联动)
  • 5-编写一个可视化代码-物品旋转(测试:脚本和物品联动)

  • 创建gdscript脚本
gdscript 复制代码
extends Node2D


# Called when the node enters the scene tree for the first time.
# 当节点首次进入场景树时调用
func _ready() -> void:
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
# 每帧调用 'delta' 是距上一帧经过的时间
func _process(delta: float) -> void:
	pass

  • 编写一个可视化代码-物品旋转
gdscript 复制代码
extends Node2D


# Called when the node enters the scene tree for the first time.
# 当节点首次进入场景树时调用
func _ready() -> void:
	print($IconSprite.position)


# Called every frame. 'delta' is the elapsed time since the previous frame.
# 每帧调用 'delta' 是距上一帧经过的时间
func _process(delta: float) -> void:
	$IconSprite.rotation += 20 * delta
	print($IconSprite.rotation)
相关推荐
一只大鸽子12 小时前
游戏开发笔记19-Godot RPG游戏基础-文本样式
笔记·游戏·godot
SEO_juper2 天前
Node.js Product 结构化数据生成器:给产品页一键生成 JSON-LD
开发语言·前端·javascript·人工智能·node.js·json·1024程序员节
一只大鸽子2 天前
游戏开发笔记17-Godot RPG游戏基础-菜单
笔记·游戏·godot
Android系统攻城狮4 天前
FFmpeg深度解析之av_codec_iterate:如何遍历音视频编解码器?(七十八)
linux·运维·ffmpeg·音视频·1024程序员节·音视频进阶
一只大鸽子7 天前
游戏开发笔记13-Godot RPG游戏基础-敌人追击逻辑、玩家死亡、新场景
笔记·godot
晚霞的不甘8 天前
Flutter/OpenHarmony 三方库适配实战:google_maps_flutter 地图
flutter·macos·华为·cocoa·harmonyos·1024程序员节
一只大鸽子9 天前
游戏开发笔记11-Godot RPG游戏基础-优化-四方向攻击
笔记·游戏·godot
一只大鸽子11 天前
游戏开发笔记9-Godot RPG游戏基础-敌人
笔记·游戏·godot
一只大鸽子13 天前
游戏开发笔记7-Godot RPG游戏基础-场景切换、全局脚本
笔记·游戏·godot
开开心心就好14 天前
显示器关不掉怎么办,用小工具一键息屏
算法·智能手机·pdf·计算机外设·ocr·lua·1024程序员节