This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tick(args) | |
args.state.game_state ||= 'playing' | |
args.state.player ||= { | |
x: 100, y: 40, w: 80, h: 80, angle: 90, | |
path: 'sprites/circle/blue.png' | |
} | |
args.state.player_bullet ||= { | |
x: 130, y: 800, w: 20, h: 20, | |
path: 'sprites/triangle/equilateral/blue.png' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# buffer pixel array data to persist across ticks | |
def tick args | |
dimension = 100 # keep it small and let the GPU scale it when rendering the sprite. | |
if args.tick_count.zero? | |
# Set up our "parray" pixel array and fill it with black pixels. | |
args.pixel_array(:parray).width = dimension | |
args.pixel_array(:parray).height = dimension | |
args.pixel_array(:parray).pixels.fill(0xFFFFFFFF, 0, dimension * dimension) # black, full alpha |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$gtk.reset | |
SPLINE = [ | |
[0.0, 0.99, 0.99, 1.0] | |
] | |
def tick args | |
# duration of movement | |
args.state.duration = 4.seconds |
OlderNewer