Getting started - Introduction - Installing Defold - The editor - Glossary - Defold for Flash users - Getting help Project setup - Creating a project - Project settings - Libraries Core concepts - Building blocks - Addressing - Message passing - Application lifecycle Assets and resources - Importing assets - Importing 2D graphics - Importing 3D models - Adapting to different screen sizes - Live update - Atlas - Font - Resource management - Tile source - Texture filtering - Texture profiles Animations - Overview - Flipbook Animation - Model animation - Property animation (tweens) - Spine animation Components - Overview - Collection factory - Collection proxy - Collision object - Camera - Factory - Label - Mesh - Model - Particle FX - Sound - Spine - Sprite - Tilemap Gui - GUI overview - Box nodes - Text nodes - Pie nodes - Spine nodes - ParticleFX nodes - Template nodes - Scripts - Clipping - Layouts Physics - Physics overview - Collision objects - Collision shapes - Collision groups - Collision messages - Resolving collisions - Ray casts - Joints and constraints Sound - Sound - FMOD Input - Overview - Key and text input - Mouse and touch - Gamepads Game logic - Scripts - Properties - Script properties - Lua in Defold - Modules - Debugging - Writing code Saving and loading files - Working with files Networking - Overview - HTTP Requests - Socket connections - WebSocket connections - Online services Rendering - Render - Material - Shader - Texture filtering Workflow - Adapting to different screen sizes - Bundling an application - Bob the builder - Hot reloading - Optimizing an application - Profiling - Refactoring - The mobile dev app - Version control - Writing code - Working offline Debugging - Debugging game logic - Debugging native code - Debugging native code on Android - Debugging native code on iOS - Reading game and system logs - Profiling Platforms - Android - iOS - Nintendo Switch - Linux - HTML5 - macOS - Windows Monetization - Ads - In-app purchases - Web Monetization Extensions - Advertising Info - Camera - Facebook - Facebook Instant Games - Firebase Analytics - Google Play Game Services - Google Play Instant - In-app purchases - Inter-app communication - Push notifications - App review and ratings - WebMonetization - WebSocket - Webview Native extensions - Introduction - Details - Defold SDK - Adding auto-complete definition - Best Practices - Debugging - Build Variants - Manifest Merging Editor extensions - Editor scripts
Read this manual in English
Spine 模型
SpineModel 组件用于把 Spine 骨骼动画在 Defold 中呈现出来.
创建 Spine Model 组件
选择一个游戏对象:
方法一 直接创建组件(右键点击 游戏对象选择 Add Component ▸ Spine Model )
方法二 先创建文件 (在 资源 浏览器中 右键点击 , 在上下文菜单中选择 New... ▸ Spine Model ), 再在游戏对象上 右键点击 , 选择 Add Component File ).
Spine Model 属性 :
除了常见的 Id , Position 和 Rotation 属性外, 还有 Spine Model 的特有属性:
Spine scene
设置先前创建的 Spine Scene.
Blend Mode
默认混合模式是 Alpha
, 想用别的可以修改这个属性.
Material
如果想要使用自定义材质显示Spine模型, 在此指定.
Default animation
设置Spine模型默认的动画.
Skin
如果模型包含皮肤的话,这里可以设置Spine模型的默认皮肤.
此时就可以在编辑器里看到Spine模型了:
混合模式
The Blend Mode property defines how the component graphics should be blended with the graphics behind it. These are the available blend modes and how they are calculated:
Alpha
Normal blending: src.a * src.rgb + (1 - src.a) * dst.rgb
Add
Brighten the background with the color values of the corresponding pixels of the component: src.rgb + dst.rgb
Multiply
Darken the background with values of the the corresponding pixels of the component: src.rgb * dst.rgb
运行时操作
有一系列方法可以在运行时修改Spine模型 (参见 API文档 ).
运行时动画
Defold 提供强大的运行时控制动画的功能, 参见 spine 动画教程 .
修改属性
Spine模型可以使用 go.get()
和 go.set()
方法修改其属性:
animation
当前Spine模型动画 (hash
) (只读). 使用 spine.play_anim()
方法来更改播放动画 (参见 spine 动画教程 ).
cursor
标准化动画头 (number
).
material
Spine模型材质 (hash
). 可使用 go.set()
修改. 参见 这个例子的 API 用法 .
playback_rate
动画播放速率 (number
).
skin
当前组件的皮肤 (hash
).
材质常量
The default spine material has the following constants that can be changed using go.set() or go.animate() (refer to the Material manual for more details ). Examples:
go . set ( "#spine" , "tint" , vmath . vector4 ( 1 , 0 , 0 , 1 ))
go . animate ( "#spine" , "tint" , go . PLAYBACK_LOOP_PINGPONG , vmath . vector4 ( 1 , 0 , 0 , 1 ), go . EASING_LINEAR , 2 )
tint
3D网格颜色 (vector4
). 四元数 x, y, z, 和 w 分别对应红, 绿, 蓝和不透明度.
相关项目配置
在 game.project 文件里有些关于Spine模型的 设置项目 .