*
Dojo 是一个经过验证的游戏引擎和工具链,用于与 Cairo 一起构建链上游戏和自治世界
curl -L https://install.dojoengine.org | bash

Architect Your World

Rapidly build and deploy onchain games and Autonomous Worlds with the Dojo toolchain. Games that are defined and governed by their smart contracts, existing entirely onchain and inheriting the unique affordances of the blockchain: composable, extensible, permissionless and persistent.

Read the Dojo Book
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 #[dojo::contract] mod player_actions { use starknet::{ContractAddress, get_caller_address}; use super::{Position, Vec2}; use super::IPlayerActions; #[external(v0)] impl PlayerActionsImpl of IPlayerActions<ContractState> { fn spawn(self: @ContractState) { // Access the world dispatcher for reading. let world = self.world_dispatcher.read(); // get player address let player = get_caller_address(); // dojo command - get player position let position = get!(world, player, (Position)); // dojo command - set player position set!(world, (Position { player, vec: Vec2 { x: 10, y: 10 } })); } } }

Partners