Skip to content

Commit

Permalink
Keep starknet::Event
Browse files Browse the repository at this point in the history
  • Loading branch information
gianalarcon committed Apr 5, 2024
1 parent a630aff commit 198d4d7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/systems/actions.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,21 @@ mod actions {

use starknet::{ContractAddress, get_caller_address};
use dojo_starter::models::{position::{Position, Vec2}, moves::{Moves, Direction}};

// // declaring custom event struct
// #[event]
// #[derive(Drop, starknet::Event)]
// enum Event {
// Moved: Moved,
// }

// // declaring custom event struct
// #[derive(starknet::Event, Model, Copy, Drop, Serde)]
// struct Moved {
// #[key]
// player: ContractAddress,
// direction: Direction
// }
// impl: implement functions specified in trait
#[abi(embed_v0)]
impl ActionsImpl of IActions<ContractState> {
Expand Down Expand Up @@ -59,8 +73,8 @@ mod actions {

// // Update the world state with the new moves data and position.
set!(world, (moves, next));

// Emit events to the world to notify about the player's move.
// Emit an event to the world to notify about the player's move.
// emit!(world, Moved { player, direction });
emit!(world,( Moves { player, remaining, last_direction: direction }));
}
}
Expand Down

0 comments on commit 198d4d7

Please sign in to comment.