Add a game director #1
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is the main game loop and it will preserve state, do checks.
Essentially the main function handles initialization of the tool by parsing flags, initializing tcell, and handig off parameters to the game director.
The game director listens for the events:
This needs some testing.
I have added a game director, and it doesn't work.
tcell
doesn't seem to have a time event I can listen to next to key presses and resizes, so I will need to split this up. There is this https://github.com/gdamore/tcell/blob/v2.6.0/event.go#L30 and*EventTime.SetEventTime(t time.Time)
, but this doesn't seem to fit the bill.So this is going to be go routine, channel and a function.
Line 1: Create the channel to communicate key presses between processes.
Line 2: This controls the direction of the snake, and placement of the apple.
Line 3: intercepts keyboard presses and either pauses, or sets the direction of the snake
This is working as intended. Now to add tank-controls.