Esta página aún no está traducida al español, por lo que se muestra la versión en inglés.
Desde otro motorComing from Construct
A map from Construct's layouts, object types, event sheets and behaviors to this layer, with the page that covers each one.
The biggest change is that there are no event sheets. In Construct you add conditions and actions to an event sheet and attach behaviors to object types; here a game is Go code inside an NSGo component, layouts are YAML scene files you write by hand or save from the editor, and the rules an event sheet holds become Go systems that run each fixed step, with a scene file's connections for the simple "when this happens, do that" wiring.
At a glance
| Construct | Here | Guide |
|---|---|---|
| Layout, layers | YAML scene document (sceneformat) with ordered layers |
Editor & Scene Format |
| Go to layout | scene.Manager.Switch with a transition |
scene |
| Object type, instances | A component type registered for scene files and a prefab; data in an entities.World |
Editor & Scene Format, Entities |
| Instance variables | A scene object's properties and its component fields |
Editor & Scene Format |
| Families | Systems that query every entity with the components they share | Entities |
| Event sheet, conditions and actions | Go systems on game.Loop; a scene's connections from an object's event to a handler |
Loop, Editor & Scene Format |
| Every tick | game.Loop.Update(dt) with a fixed dt |
Loop |
| Global variables | Plain Go values made once in the root component and passed to the scenes that need them | Coming from Godot |
| Functions, custom actions | Go functions and methods | — |
| Keyboard, Mouse, Touch and Gamepad objects | input.Actions with named actions and axes |
input |
| Sprite, animations | sprite.LoadAtlas frames and animations, *.states.yaml sprite state machines |
sprite, animclip |
| Tilemap object | Tiled maps through tilemap.LoadTiled |
tilemap |
| Particles object | particles.Emitter |
particles |
| Timeline | animclip clips played through tween.Timeline |
animclip, tween |
| Local Storage | save slots in versioned JSON with migrations |
save |
| Export project | go tool game release |
Building and Shipping |
Behaviors
| Construct behavior | Here | Guide |
|---|---|---|
| Platform | platformer.Controller with coyote time, jump buffer and wall jump from a YAML config |
platformer |
| Solid | The built-in collider2d component, or physics.TileSolid tiles |
physics |
| Jump-thru | physics.TileOneWay tiles, or a Body with OneWay set |
physics |
| Pathfinding | pathfind.NavAgent on a 2D NavMesh, or grid AStar |
pathfind |
| Line of Sight | ai.Perception with sight, hearing and memory |
ai |
| Timer | The built-in timer component, or flow.Timers in Go |
Editor & Scene Format, flow |
| Tween | tween.Tween and tween.Timeline |
tween |
| Physics | physics.RigidWorld and RigidBody |
2D Rigid Bodies |
| Bullet, Sine, Rotate, Orbit, Wrap, Bound to layout, Destroy outside layout, Fade, Flash, Move To | The built-in bullet, sine, rotate, orbit, wrap, bound, destroy_outside, fade, flash and move_to components, stepped by BuiltScene.Step |
Editor & Scene Format |
| 8 Direction | The eight_direction component's settings, stepped from Go with sceneformat.StepEightDirection; the scene runtime does not step it yet (#1752) |
scene |
| Tile Movement, Car, Drag & Drop, Turret | Not yet; the tile_movement, car, drag_drop and turret components validate their settings, but nothing steps them yet (#1752) |
scene |
First project
Start from a template close to the game you have: go run github.com/nsgo-dev/game/cmd/game@latest new -template platformer2d mygame writes a platformer with rooms, a controller and a checkpoint (guide), and new -list names the others (Templates). Open the project with go tool game editor: its 2D viewport is the layout view, its inspector edits an object's components and properties in place of the Properties bar, and the files it saves are the same YAML the game loads.