diff options
| author | Amir Rajan <[email protected]> | 2020-09-11 02:02:01 -0500 |
|---|---|---|
| committer | Amir Rajan <[email protected]> | 2020-09-11 02:02:57 -0500 |
| commit | 33ec37b141e896b47ed642923fd33b0c658ae9fb (patch) | |
| tree | a40d3e5d41beeb06508200078f6f26b0ee57d6a4 /samples/03_rendering_sprites | |
| parent | 958cf43779d2bf528869e80511c4c4f2a433b2db (diff) | |
| download | dragonruby-game-toolkit-contrib-33ec37b141e896b47ed642923fd33b0c658ae9fb.tar.gz dragonruby-game-toolkit-contrib-33ec37b141e896b47ed642923fd33b0c658ae9fb.zip | |
synced samples
Diffstat (limited to 'samples/03_rendering_sprites')
22 files changed, 1804 insertions, 0 deletions
diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/app/main.rb b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/app/main.rb new file mode 100644 index 0000000..80c40f2 --- /dev/null +++ b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/app/main.rb @@ -0,0 +1,131 @@ +=begin + + Reminders: + + - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated + as Ruby code, and the placeholder is replaced with its corresponding value or result. + + In this sample app, we're using string interpolation to iterate through images in the + sprites folder using their image path names. + + - args.outputs.sprites: An array. Values in this array generate sprites on the screen. + The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH] + For more information about sprites, go to mygame/documentation/05-sprites.md. + + - args.outputs.labels: An array. Values in the array generate labels on the screen. + The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE] + For more information about labels, go to mygame/documentation/02-labels.md. + + - args.inputs.keyboard.key_down.KEY: Determines if a key is in the down state, or pressed. + Stores the frame that key was pressed on. + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + +=end + +# This sample app demonstrates how sprite animations work. +# There are two sprites that animate forever and one sprite +# that *only* animates when you press the "f" key on the keyboard. + +# This is the entry point to your game. The `tick` method +# executes at 60 frames per second. There are two methods +# in this tick "entry point": `looping_animation`, and the +# second method is `one_time_animation`. +def tick args + looping_animation args + one_time_animation args +end + +# This function shows how to animate a sprite that loops forever. +def looping_animation args + # Here we define a few local variables that will be sent + # into the magic function that gives us the correct sprite image + # over time. There are four things we need in order to figure + # out which sprite to show. + + # 1. When to start the animation. + start_looping_at = 0 + + # 2. The number of pngs that represent the full animation. + number_of_sprites = 6 + + # 3. How long to show each png. + number_of_frames_to_show_each_sprite = 4 + + # 4. Whether the animation should loop once, or forever. + does_sprite_loop = true + + # With the variables defined above, we can get a number + # which represents the sprite to show by calling the `frame_index` function. + # In this case the number will be between 0, and 5 (you can see the sprites + # in the ./sprites directory). + sprite_index = start_looping_at.frame_index number_of_sprites, + number_of_frames_to_show_each_sprite, + does_sprite_loop + + # Now that we have `sprite_index, we can present the correct file. + args.outputs.sprites << [100, 100, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + + # Try changing the numbers below to see how the animation changes: + args.outputs.sprites << [100, 200, 100, 100, "sprites/dragon_fly_#{0.frame_index 6, 4, true}.png"] +end + +# This function shows how to animate a sprite that executes +# only once when the "f" key is pressed. +def one_time_animation args + # This is just a label the shows instructions within the game. + args.outputs.labels << [220, 350, "(press f to animate)"] + + # If "f" is pressed on the keyboard... + if args.inputs.keyboard.key_down.f + # Print the frame that "f" was pressed on. + puts "Hello from main.rb! The \"f\" key was in the down state on frame: #{args.inputs.keyboard.key_down.f}" + + # And MOST IMPORTANTLY set the point it time to start the animation, + # equal to "now" which is represented as args.state.tick_count. + + # Also IMPORTANT, you'll notice that the value of when to start looping + # is stored in `args.state`. This construct's values are retained across + # executions of the `tick` method. + args.state.start_looping_at = args.state.tick_count + end + + # These are the same local variables that were defined + # for the `looping_animation` function. + number_of_sprites = 6 + number_of_frames_to_show_each_sprite = 4 + + # Except this sprite does not loop again. If the animation time has passed, + # then the frame_index function returns nil. + does_sprite_loop = false + + sprite_index = args.state + .start_looping_at + .frame_index number_of_sprites, + number_of_frames_to_show_each_sprite, + does_sprite_loop + + # This line sets the frame index to zero, if + # the animation duration has passed (frame_index returned nil). + + # Remeber: we are not looping forever here. + sprite_index ||= 0 + + # Present the sprite. + args.outputs.sprites << [100, 300, 100, 100, "sprites/dragon_fly_#{sprite_index}.png"] + + tick_instructions args, "Sample app shows how to use Numeric#frame_index and string interpolation to animate a sprite over time." +end + +def tick_instructions args, text, y = 715 + return if args.state.key_event_occurred + if args.inputs.mouse.click || + args.inputs.keyboard.directional_vector || + args.inputs.keyboard.key_down.enter || + args.inputs.keyboard.key_down.escape + args.state.key_event_occurred = true + end + + args.outputs.debug << [0, y - 50, 1280, 60].solid + args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label + args.outputs.debug << [640, y - 25, "(click to dismiss instructions)" , -2, 1, 255, 255, 255].label +end diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/license-for-sample.txt b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/license-for-sample.txt new file mode 100644 index 0000000..8fa4d42 --- /dev/null +++ b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC (code), Nick Culbertson @mobypixel (art) + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/replay.txt b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/replay.txt new file mode 100644 index 0000000..33c47c3 --- /dev/null +++ b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/replay.txt @@ -0,0 +1,162 @@ +replay_version 2.0 +stopped_at 780 +seed 100 +recorded_at Sun Sep 29 21:41:16 2019 +[:mouse_move, 1081, 144, 2, 1, 54] +[:mouse_move, 1076, 144, 2, 2, 55] +[:mouse_move, 1061, 145, 2, 3, 56] +[:mouse_move, 1049, 146, 2, 4, 57] +[:mouse_move, 964, 148, 2, 5, 58] +[:mouse_move, 899, 148, 2, 6, 59] +[:mouse_move, 795, 153, 2, 7, 60] +[:mouse_move, 728, 160, 2, 8, 61] +[:mouse_move, 644, 175, 2, 9, 62] +[:mouse_move, 597, 185, 2, 10, 63] +[:mouse_move, 519, 206, 2, 11, 64] +[:mouse_move, 488, 217, 2, 12, 65] +[:mouse_move, 451, 229, 2, 13, 66] +[:mouse_move, 443, 231, 2, 14, 67] +[:mouse_move, 438, 233, 2, 15, 68] +[:mouse_move, 423, 238, 2, 16, 69] +[:mouse_move, 420, 239, 2, 17, 70] +[:mouse_move, 416, 240, 2, 18, 71] +[:mouse_move, 415, 240, 2, 19, 84] +[:mouse_move, 394, 253, 2, 20, 85] +[:mouse_move, 376, 264, 2, 21, 86] +[:mouse_move, 329, 296, 2, 22, 87] +[:mouse_move, 303, 315, 2, 23, 88] +[:mouse_move, 268, 342, 2, 24, 89] +[:mouse_move, 249, 356, 2, 25, 90] +[:mouse_move, 234, 372, 2, 26, 91] +[:mouse_move, 228, 380, 2, 27, 92] +[:mouse_move, 223, 388, 2, 28, 93] +[:mouse_move, 222, 391, 2, 29, 94] +[:mouse_move, 221, 394, 2, 30, 95] +[:mouse_move, 221, 396, 2, 31, 96] +[:mouse_move, 223, 397, 2, 32, 97] +[:mouse_move, 229, 397, 2, 33, 98] +[:mouse_move, 231, 397, 2, 34, 99] +[:mouse_move, 235, 397, 2, 35, 100] +[:mouse_move, 237, 397, 2, 36, 101] +[:mouse_move, 238, 397, 2, 37, 102] +[:mouse_move, 238, 398, 2, 38, 105] +[:mouse_move, 237, 398, 2, 39, 108] +[:mouse_move, 236, 397, 2, 40, 110] +[:mouse_move, 235, 397, 2, 41, 111] +[:mouse_move, 237, 397, 2, 42, 139] +[:mouse_move, 240, 397, 2, 43, 140] +[:mouse_move, 245, 398, 2, 44, 141] +[:mouse_move, 248, 398, 2, 45, 142] +[:mouse_move, 255, 399, 2, 46, 143] +[:mouse_move, 258, 399, 2, 47, 144] +[:mouse_move, 266, 400, 2, 48, 145] +[:mouse_move, 268, 400, 2, 49, 146] +[:mouse_move, 273, 400, 2, 50, 147] +[:mouse_move, 275, 400, 2, 51, 148] +[:mouse_move, 277, 400, 2, 52, 149] +[:mouse_move, 280, 400, 2, 53, 150] +[:mouse_move, 282, 400, 2, 54, 151] +[:mouse_move, 285, 400, 2, 55, 152] +[:mouse_move, 286, 399, 2, 56, 153] +[:mouse_move, 288, 399, 2, 57, 154] +[:mouse_move, 289, 399, 2, 58, 155] +[:mouse_move, 290, 399, 2, 59, 156] +[:mouse_move, 291, 399, 2, 60, 157] +[:mouse_move, 294, 399, 2, 61, 158] +[:mouse_move, 295, 399, 2, 62, 159] +[:mouse_move, 297, 399, 2, 63, 160] +[:mouse_move, 298, 399, 2, 64, 161] +[:mouse_move, 300, 398, 2, 65, 162] +[:mouse_move, 302, 398, 2, 66, 163] +[:mouse_move, 305, 398, 2, 67, 164] +[:mouse_move, 307, 398, 2, 68, 165] +[:mouse_move, 310, 398, 2, 69, 166] +[:mouse_move, 312, 398, 2, 70, 167] +[:mouse_move, 315, 397, 2, 71, 168] +[:mouse_move, 317, 397, 2, 72, 169] +[:mouse_move, 320, 397, 2, 73, 170] +[:mouse_move, 321, 397, 2, 74, 171] +[:mouse_move, 323, 397, 2, 75, 172] +[:mouse_move, 325, 397, 2, 76, 173] +[:mouse_move, 327, 397, 2, 77, 174] +[:mouse_move, 328, 397, 2, 78, 175] +[:mouse_move, 329, 397, 2, 79, 176] +[:mouse_move, 332, 397, 2, 80, 177] +[:mouse_move, 333, 397, 2, 81, 178] +[:mouse_move, 336, 397, 2, 82, 179] +[:mouse_move, 338, 397, 2, 83, 180] +[:mouse_move, 341, 397, 2, 84, 181] +[:mouse_move, 342, 397, 2, 85, 182] +[:mouse_move, 345, 397, 2, 86, 183] +[:mouse_move, 346, 397, 2, 87, 184] +[:mouse_move, 350, 397, 2, 88, 185] +[:mouse_move, 352, 397, 2, 89, 186] +[:mouse_move, 355, 397, 2, 90, 187] +[:mouse_move, 356, 397, 2, 91, 188] +[:mouse_move, 359, 397, 2, 92, 189] +[:mouse_move, 360, 397, 2, 93, 190] +[:mouse_move, 363, 397, 2, 94, 191] +[:mouse_move, 365, 397, 2, 95, 192] +[:mouse_move, 367, 397, 2, 96, 193] +[:mouse_move, 369, 397, 2, 97, 194] +[:mouse_move, 372, 397, 2, 98, 195] +[:mouse_move, 373, 397, 2, 99, 196] +[:mouse_move, 376, 397, 2, 100, 197] +[:mouse_move, 377, 397, 2, 101, 198] +[:mouse_move, 379, 397, 2, 102, 199] +[:mouse_move, 381, 397, 2, 103, 200] +[:mouse_move, 383, 397, 2, 104, 201] +[:mouse_move, 385, 397, 2, 105, 202] +[:mouse_move, 386, 397, 2, 106, 203] +[:mouse_move, 389, 397, 2, 107, 204] +[:mouse_move, 391, 397, 2, 108, 205] +[:mouse_move, 397, 397, 2, 109, 206] +[:mouse_move, 398, 397, 2, 110, 207] +[:mouse_move, 403, 397, 2, 111, 208] +[:mouse_move, 405, 397, 2, 112, 209] +[:mouse_move, 407, 397, 2, 113, 210] +[:mouse_move, 409, 397, 2, 114, 211] +[:mouse_move, 410, 397, 2, 115, 212] +[:mouse_move, 411, 397, 2, 116, 218] +[:mouse_move, 411, 395, 2, 117, 328] +[:mouse_move, 411, 393, 2, 118, 329] +[:mouse_move, 412, 387, 2, 119, 330] +[:mouse_move, 413, 382, 2, 120, 331] +[:mouse_move, 415, 371, 2, 121, 332] +[:mouse_move, 416, 364, 2, 122, 333] +[:mouse_move, 417, 349, 2, 123, 334] +[:mouse_move, 418, 343, 2, 124, 335] +[:mouse_move, 419, 335, 2, 125, 336] +[:mouse_move, 419, 332, 2, 126, 337] +[:mouse_move, 420, 328, 2, 127, 338] +[:mouse_move, 420, 327, 2, 128, 339] +[:mouse_move, 420, 329, 2, 129, 345] +[:mouse_move, 421, 331, 2, 130, 346] +[:mouse_move, 421, 332, 2, 131, 347] +[:mouse_move, 421, 333, 2, 132, 348] +[:mouse_move, 422, 334, 2, 133, 349] +[:key_down_raw, 102, 0, 2, 134, 411] +[:key_up_raw, 102, 0, 2, 135, 417] +[:key_down_raw, 102, 0, 2, 136, 470] +[:key_up_raw, 102, 0, 2, 137, 476] +[:key_down_raw, 102, 0, 2, 138, 526] +[:key_up_raw, 102, 0, 2, 139, 531] +[:key_down_raw, 102, 0, 2, 140, 537] +[:key_up_raw, 102, 0, 2, 141, 541] +[:key_down_raw, 102, 0, 2, 142, 546] +[:key_up_raw, 102, 0, 2, 143, 550] +[:key_down_raw, 102, 0, 2, 144, 555] +[:key_up_raw, 102, 0, 2, 145, 558] +[:key_down_raw, 102, 0, 2, 146, 563] +[:key_up_raw, 102, 0, 2, 147, 567] +[:key_down_raw, 102, 0, 2, 148, 572] +[:key_up_raw, 102, 0, 2, 149, 575] +[:key_down_raw, 102, 0, 2, 150, 579] +[:key_up_raw, 102, 0, 2, 151, 582] +[:key_down_raw, 102, 0, 2, 152, 632] +[:key_up_raw, 102, 0, 2, 153, 657] +[:key_down_raw, 102, 0, 2, 154, 687] +[:key_up_raw, 102, 0, 2, 155, 692] +[:key_down_raw, 1073742051, 1024, 2, 156, 779] +[:key_down_raw, 113, 1024, 2, 157, 779] +[:key_up_raw, 113, 1024, 2, 158, 779] diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_0.png b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_0.png Binary files differnew file mode 100644 index 0000000..fb179af --- /dev/null +++ b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_0.png diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_1.png b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_1.png Binary files differnew file mode 100644 index 0000000..8cfe531 --- /dev/null +++ b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_1.png diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_2.png b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_2.png Binary files differnew file mode 100644 index 0000000..cb462e1 --- /dev/null +++ b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_2.png diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_3.png b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_3.png Binary files differnew file mode 100644 index 0000000..04c4977 --- /dev/null +++ b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_3.png diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_4.png b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_4.png Binary files differnew file mode 100644 index 0000000..b29fa3d --- /dev/null +++ b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_4.png diff --git a/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_5.png b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_5.png Binary files differnew file mode 100644 index 0000000..99f4e74 --- /dev/null +++ b/samples/03_rendering_sprites/01_animation_using_seperate_pngs/sprites/dragon_fly_5.png diff --git a/samples/03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb b/samples/03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb new file mode 100644 index 0000000..17bfd49 --- /dev/null +++ b/samples/03_rendering_sprites/02_animation_using_sprite_sheet/app/main.rb @@ -0,0 +1,98 @@ +def tick args + args.state.player.x ||= 100 + args.state.player.y ||= 100 + args.state.player.w ||= 64 + args.state.player.h ||= 64 + args.state.player.direction ||= 1 + + args.state.player.is_moving = false + + # get the keyboard input and set player properties + if args.inputs.keyboard.right + args.state.player.x += 3 + args.state.player.direction = 1 + args.state.player.started_running_at ||= args.state.tick_count + elsif args.inputs.keyboard.left + args.state.player.x -= 3 + args.state.player.direction = -1 + args.state.player.started_running_at ||= args.state.tick_count + end + + if args.inputs.keyboard.up + args.state.player.y += 1 + args.state.player.started_running_at ||= args.state.tick_count + elsif args.inputs.keyboard.down + args.state.player.y -= 1 + args.state.player.started_running_at ||= args.state.tick_count + end + + # if no arrow keys are being pressed, set the player as not moving + if !args.inputs.keyboard.directional_vector + args.state.player.started_running_at = nil + end + + # wrap player around the stage + if args.state.player.x > 1280 + args.state.player.x = -64 + args.state.player.started_running_at ||= args.state.tick_count + elsif args.state.player.x < -64 + args.state.player.x = 1280 + args.state.player.started_running_at ||= args.state.tick_count + end + + if args.state.player.y > 720 + args.state.player.y = -64 + args.state.player.started_running_at ||= args.state.tick_count + elsif args.state.player.y < -64 + args.state.player.y = 720 + args.state.player.started_running_at ||= args.state.tick_count + end + + # render player as standing or running + if args.state.player.started_running_at + args.outputs.sprites << running_sprite(args) + else + args.outputs.sprites << standing_sprite(args) + end + args.outputs.labels << [30, 700, "Use arrow keys to move around."] +end + +def standing_sprite args + { + x: args.state.player.x, + y: args.state.player.y, + w: args.state.player.w, + h: args.state.player.h, + path: "sprites/horizontal-stand.png", + flip_horizontally: args.state.player.direction > 0 + } +end + +def running_sprite args + if !args.state.player.started_running_at + tile_index = 0 + else + how_many_frames_in_sprite_sheet = 6 + how_many_ticks_to_hold_each_frame = 3 + should_the_index_repeat = true + tile_index = args.state + .player + .started_running_at + .frame_index(how_many_frames_in_sprite_sheet, + how_many_ticks_to_hold_each_frame, + should_the_index_repeat) + end + + { + x: args.state.player.x, + y: args.state.player.y, + w: args.state.player.w, + h: args.state.player.h, + path: 'sprites/horizontal-run.png', + tile_x: 0 + (tile_index * args.state.player.w), + tile_y: 0, + tile_w: args.state.player.w, + tile_h: args.state.player.h, + flip_horizontally: args.state.player.direction > 0, + } +end diff --git a/samples/03_rendering_sprites/02_animation_using_sprite_sheet/license-for-sample.txt b/samples/03_rendering_sprites/02_animation_using_sprite_sheet/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/03_rendering_sprites/02_animation_using_sprite_sheet/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/03_rendering_sprites/02_animation_using_sprite_sheet/sprites/horizontal-run.png b/samples/03_rendering_sprites/02_animation_using_sprite_sheet/sprites/horizontal-run.png Binary files differnew file mode 100644 index 0000000..1e98253 --- /dev/null +++ b/samples/03_rendering_sprites/02_animation_using_sprite_sheet/sprites/horizontal-run.png diff --git a/samples/03_rendering_sprites/02_animation_using_sprite_sheet/sprites/horizontal-stand.png b/samples/03_rendering_sprites/02_animation_using_sprite_sheet/sprites/horizontal-stand.png Binary files differnew file mode 100644 index 0000000..9d320e7 --- /dev/null +++ b/samples/03_rendering_sprites/02_animation_using_sprite_sheet/sprites/horizontal-stand.png diff --git a/samples/03_rendering_sprites/03_animation_states/app/main.rb b/samples/03_rendering_sprites/03_animation_states/app/main.rb new file mode 100644 index 0000000..63608a4 --- /dev/null +++ b/samples/03_rendering_sprites/03_animation_states/app/main.rb @@ -0,0 +1,183 @@ +class Game + attr_gtk + + def defaults + state.show_debug_layer = true if state.tick_count == 0 + player.tile_size = 64 + player.speed = 3 + player.slash_frames = 15 + player.x ||= 50 + player.y ||= 400 + player.dir_x ||= 1 + player.dir_y ||= -1 + player.is_moving ||= false + state.watch_list ||= {} + state.enemies ||= [] + end + + def add_enemy + state.enemies << { x: 1200 * rand, y: 600 * rand, w: 64, h: 64 } + end + + def sprite_horizontal_run + tile_index = 0.frame_index(6, 3, true) + tile_index = 0 if !player.is_moving + + { + x: player.x, + y: player.y, + w: player.tile_size, + h: player.tile_size, + path: 'sprites/horizontal-run.png', + tile_x: 0 + (tile_index * player.tile_size), + tile_y: 0, + tile_w: player.tile_size, + tile_h: player.tile_size, + flip_horizontally: player.dir_x > 0, + # a: 40 + } + end + + def sprite_horizontal_stand + { + x: player.x, + y: player.y, + w: player.tile_size, + h: player.tile_size, + path: 'sprites/horizontal-stand.png', + flip_horizontally: player.dir_x > 0, + # a: 40 + } + end + + def sprite_horizontal_slash + tile_index = player.slash_at.frame_index(5, player.slash_frames.idiv(5), false) || 0 + + { + x: player.x - 41.25, + y: player.y - 41.25, + w: 165, + h: 165, + path: 'sprites/horizontal-slash.png', + tile_x: 0 + (tile_index * 128), + tile_y: 0, + tile_w: 128, + tile_h: 128, + flip_horizontally: player.dir_x > 0 + } + end + + def render_player + if player.slash_at + outputs.sprites << sprite_horizontal_slash + elsif player.is_moving + outputs.sprites << sprite_horizontal_run + else + outputs.sprites << sprite_horizontal_stand + end + end + + def render_enemies + outputs.borders << state.enemies + end + + def render_debug_layer + return if !state.show_debug_layer + outputs.labels << state.watch_list.map.with_index do |(k, v), i| + [30, 710 - i * 28, "#{k}: #{v || "(nil)"}"] + end + + outputs.borders << player.slash_collision_rect + end + + def slash_initiate? + # buffalo usb controller has a button and b button swapped lol + inputs.controller_one.key_down.a || inputs.keyboard.key_down.j + end + + def input + # player movement + if slash_complete? && (vector = inputs.directional_vector) + player.x += vector.x * player.speed + player.y += vector.y * player.speed + end + player.slash_at = slash_initiate? if slash_initiate? + end + + def calc_movement + # movement + if vector = inputs.directional_vector + state.debug_label = vector + player.dir_x = vector.x + player.dir_y = vector.y + player.is_moving = true + else + state.debug_label = vector + player.is_moving = false + end + end + + def calc_slash + # re-calc the location of the swords collision box + if player.dir_x.positive? + player.slash_collision_rect = [player.x + player.tile_size, + player.y + player.tile_size.half - 10, + 40, 20] + else + player.slash_collision_rect = [player.x - 32 - 8, + player.y + player.tile_size.half - 10, + 40, 20] + end + + # recalc sword's slash state + player.slash_at = nil if slash_complete? + + # determine collision if the sword is at it's point of damaging + return unless slash_can_damage? + + state.enemies.reject! { |e| e.intersect_rect? player.slash_collision_rect } + end + + def slash_complete? + !player.slash_at || player.slash_at.elapsed?(player.slash_frames) + end + + def slash_can_damage? + # damage occurs half way into the slash animation + return false if slash_complete? + return false if (player.slash_at + player.slash_frames.idiv(2)) != state.tick_count + return true + end + + def calc + # generate an enemy if there aren't any on the screen + add_enemy if state.enemies.length == 0 + calc_movement + calc_slash + end + + # source is at http://github.com/amirrajan/dragonruby-link-to-the-past + def tick + defaults + render_enemies + render_player + outputs.labels << [30, 30, "Gamepad: D-Pad to move. B button to attack."] + outputs.labels << [30, 52, "Keyboard: WASD/Arrow keys to move. J to attack."] + render_debug_layer + input + calc + end + + def player + state.player + end +end + +$game = Game.new + +def tick args + $game.args = args + $game.tick +end + +$gtk.reset diff --git a/samples/03_rendering_sprites/03_animation_states/license-for-sample.txt b/samples/03_rendering_sprites/03_animation_states/license-for-sample.txt new file mode 100644 index 0000000..48fe983 --- /dev/null +++ b/samples/03_rendering_sprites/03_animation_states/license-for-sample.txt @@ -0,0 +1,86 @@ +====================================== +====== LICENSE FOR CODE ============== +====================================== + +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +========================================= +====== LICENSE FOR SPRITES ============== +========================================= + +Creative Commons + +Attribution-NonCommercial 3.0 Unported + +CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE. +License +THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. + +BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. + +1. Definitions + +"Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License. +"Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License. +"Distribute" means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale or other transfer of ownership. +"Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License. +"Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast. +"Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work. +"You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation. +"Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images. +"Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium. +2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws. + +3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: + +to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections; +to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified."; +to Distribute and Publicly Perform the Work including as incorporated in Collections; and, +to Distribute and Publicly Perform Adaptations. +The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved, including but not limited to the rights set forth in Section 4(d). + +4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: + +You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(c), as requested. +You may not exercise any of the rights granted to You in Section 3 above in any manner that is primarily intended for or directed toward commercial advantage or private monetary compensation. The exchange of the Work for other copyrighted works by means of digital file-sharing or otherwise shall not be considered to be intended for or directed toward commercial advantage or private monetary compensation, provided there is no payment of any monetary compensation in connection with the exchange of copyrighted works. +If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and, (iv) consistent with Section 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties. +For the avoidance of doubt: + +Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; +Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License if Your exercise of such rights is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(b) and otherwise waives the right to collect royalties through any statutory or compulsory licensing scheme; and, +Voluntary License Schemes. The Licensor reserves the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License that is for a purpose or use which is otherwise than noncommercial as permitted under Section 4(c). +Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise. +5. Representations, Warranties and Disclaimer + +UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. + +6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. Termination + +This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. +Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above. +8. Miscellaneous + +Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License. +Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License. +If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. +No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent. +This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You. +The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law. +Creative Commons Notice +Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of Licensor. + +Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, Creative Commons does not authorize the use by either party of the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time. For the avoidance of doubt, this trademark restriction does not form part of the License. + +Creative Commons may be contacted at https://creativecommons.org/. + +« Back to Commons Deed diff --git a/samples/03_rendering_sprites/03_animation_states/sprites/horizontal-run.png b/samples/03_rendering_sprites/03_animation_states/sprites/horizontal-run.png Binary files differnew file mode 100644 index 0000000..aabb47a --- /dev/null +++ b/samples/03_rendering_sprites/03_animation_states/sprites/horizontal-run.png diff --git a/samples/03_rendering_sprites/03_animation_states/sprites/horizontal-slash.png b/samples/03_rendering_sprites/03_animation_states/sprites/horizontal-slash.png Binary files differnew file mode 100644 index 0000000..3b0dc87 --- /dev/null +++ b/samples/03_rendering_sprites/03_animation_states/sprites/horizontal-slash.png diff --git a/samples/03_rendering_sprites/03_animation_states/sprites/horizontal-stand.png b/samples/03_rendering_sprites/03_animation_states/sprites/horizontal-stand.png Binary files differnew file mode 100644 index 0000000..77eb7ec --- /dev/null +++ b/samples/03_rendering_sprites/03_animation_states/sprites/horizontal-stand.png diff --git a/samples/03_rendering_sprites/04_color_and_rotation/app/main.rb b/samples/03_rendering_sprites/04_color_and_rotation/app/main.rb new file mode 100644 index 0000000..c3f2d8f --- /dev/null +++ b/samples/03_rendering_sprites/04_color_and_rotation/app/main.rb @@ -0,0 +1,226 @@ +=begin + APIs listing that haven't been encountered in previous sample apps: + + - merge: Returns a hash containing the contents of two original hashes. + Merge does not allow duplicate keys, so the value of a repeated key + will be overwritten. + + For example, if we had two hashes + h1 = { "a" => 1, "b" => 2} + h2 = { "b" => 3, "c" => 3} + and we called the command + h1.merge(h2) + the result would the following hash + { "a" => 1, "b" => 3, "c" => 3}. + + Reminders: + + - Hashes: Collection of unique keys and their corresponding values. The value can be found + using their keys. + In this sample app, we're using a hash to create a sprite. + + - args.outputs.sprites: An array. The values generate a sprite. + The parameters are [X, Y, WIDTH, HEIGHT, PATH, ANGLE, ALPHA, RED, GREEN, BLUE] + Before continuing with this sample app, it is HIGHLY recommended that you look + at mygame/documentation/05-sprites.md. + + - args.inputs.keyboard.key_held.KEY: Determines if a key is being pressed. + For more information about the keyboard, go to mygame/documentation/06-keyboard.md. + + - args.inputs.controller_one: Takes input from the controller based on what key is pressed. + For more information about the controller, go to mygame/documentation/08-controllers.md. + + - num1.lesser(num2): Finds the lower value of the given options. + +=end + +# This sample app shows a car moving across the screen. It loops back around if it exceeds the dimensions of the screen, +# and also can be moved in different directions through keyboard input from the user. + +# Calls the methods necessary for the game to run successfully. +def tick args + default args + render args.grid, args.outputs, args.state + calc args.state + process_inputs args +end + +# Sets default values for the car sprite +# Initialization ||= only happens in the first frame +def default args + args.state.sprite.width = 19 + args.state.sprite.height = 10 + args.state.sprite.scale = 4 + args.state.max_speed = 5 + args.state.x ||= 100 + args.state.y ||= 100 + args.state.speed ||= 1 + args.state.angle ||= 0 +end + +# Outputs sprite onto screen +def render grid, outputs, state + outputs.solids << [grid.rect, 70, 70, 70] # outputs gray background + outputs.sprites << [destination_rect(state), # sets first four parameters of car sprite + 'sprites/86.png', # image path of car + state.angle, + opacity, # transparency + saturation, + source_rect(state), # sprite sub division/tile (tile x, y, w, h) + false, false, # don't flip sprites + rotation_anchor] + + # also look at the create_sprite helper method + # + # For example: + # + # dest = destination_rect(state) + # source = source_rect(state), + # outputs.sprites << create_sprite( + # 'sprites/86.png', + # x: dest.x, + # y: dest.y, + # w: dest.w, + # h: dest.h, + # angle: state.angle, + # source_x: source.x, + # source_y: source.y, + # source_w: source.w, + # source_h: source.h, + # flip_h: false, + # flip_v: false, + # rotation_anchor_x: 0.7, + # rotation_anchor_y: 0.5 + # ) +end + +# Creates sprite by setting values inside of a hash +def create_sprite path, options = {} + options = { + + # dest x, y, w, h + x: 0, + y: 0, + w: 100, + h: 100, + + # angle, rotation + angle: 0, + rotation_anchor_x: 0.5, + rotation_anchor_y: 0.5, + + # color saturation (red, green, blue), transparency + r: 255, + g: 255, + b: 255, + a: 255, + + # source x, y, width, height + source_x: 0, + source_y: 0, + source_w: -1, + source_h: -1, + + # flip horiztonally, flip vertically + flip_h: false, + flip_v: false, + + }.merge options + + [ + options[:x], options[:y], options[:w], options[:h], # dest rect keys + path, + options[:angle], options[:a], options[:r], options[:g], options[:b], # angle, color, alpha + options[:source_x], options[:source_y], options[:source_w], options[:source_h], # source rect keys + options[:flip_h], options[:flip_v], # flip + options[:rotation_anchor_x], options[:rotation_anchor_y], # rotation anchor + ] # hash keys contain corresponding values +end + +# Calls the calc_pos and calc_wrap methods. +def calc state + calc_pos state + calc_wrap state +end + +# Changes sprite's position on screen +# Vectors have magnitude and direction, so the incremented x and y values give the car direction +def calc_pos state + state.x += state.angle.vector_x * state.speed # increments x by product of angle's x vector and speed + state.y += state.angle.vector_y * state.speed # increments y by product of angle's y vector and speed + state.speed *= 1.1 # scales speed up + state.speed = state.speed.lesser(state.max_speed) # speed is either current speed or max speed, whichever has a lesser value (ensures that the car doesn't go too fast or exceed the max speed) +end + +# The screen's dimensions are 1280x720. If the car goes out of scope, +# it loops back around on the screen. +def calc_wrap state + + # car returns to left side of screen if it disappears on right side of screen + # sprite.width refers to tile's size, which is multipled by scale (4) to make it bigger + state.x = -state.sprite.width * state.sprite.scale if state.x - 20 > 1280 + + # car wraps around to right side of screen if it disappears on the left side + state.x = 1280 if state.x + state.sprite.width * state.sprite.scale + 20 < 0 + + # car wraps around to bottom of screen if it disappears at the top of the screen + # if you subtract 520 pixels instead of 20 pixels, the car takes longer to reappear (try it!) + state.y = 0 if state.y - 20 > 720 # if 20 pixels less than car's y position is greater than vertical scope + + # car wraps around to top of screen if it disappears at the bottom of the screen + state.y = 720 if state.y + state.sprite.height * state.sprite.scale + 20 < 0 +end + +# Changes angle of sprite based on user input from keyboard or controller +def process_inputs args + + # NOTE: increasing the angle doesn't mean that the car will continue to go + # in a specific direction. The angle is increasing, which means that if the + # left key was kept in the "down" state, the change in the angle would cause + # the car to go in a counter-clockwise direction and form a circle (360 degrees) + if args.inputs.keyboard.key_held.left # if left key is pressed + args.state.angle += 2 # car's angle is incremented by 2 + + # The same applies to decreasing the angle. If the right key was kept in the + # "down" state, the decreasing angle would cause the car to go in a clockwise + # direction and form a circle (360 degrees) + elsif args.inputs.keyboard.key_held.right # if right key is pressed + args.state.angle -= 2 # car's angle is decremented by 2 + + # Input from a controller can also change the angle of the car + elsif args.inputs.controller_one.left_analog_x_perc != 0 + args.state.angle += 2 * args.inputs.controller_one.left_analog_x_perc * -1 + end +end + +# A sprite's center of rotation can be altered +# Increasing either of these numbers would dramatically increase the +# car's drift when it turns! +def rotation_anchor + [0.7, 0.5] +end + +# Sets opacity value of sprite to 255 so that it is not transparent at all +# Change it to 0 and you won't be able to see the car sprite on the screen +def opacity + 255 +end + +# Sets the color of the sprite to white. +def saturation + [255, 255, 255] +end + +# Sets definition of destination_rect (used to define the car sprite) +def destination_rect state + [state.x, state.y, + state.sprite.width * state.sprite.scale, # multiplies by 4 to set size + state.sprite.height * state.sprite.scale] +end + +# Portion of a sprite (a tile) +# Sub division of sprite is denoted as a rectangle directly related to original size of .png +# Tile is located at bottom left corner within a 19x10 pixel rectangle (based on sprite.width, sprite.height) +def source_rect state + [0, 0, state.sprite.width, state.sprite.height] +end diff --git a/samples/03_rendering_sprites/04_color_and_rotation/license-for-sample.txt b/samples/03_rendering_sprites/04_color_and_rotation/license-for-sample.txt new file mode 100644 index 0000000..100dcec --- /dev/null +++ b/samples/03_rendering_sprites/04_color_and_rotation/license-for-sample.txt @@ -0,0 +1,9 @@ +Copyright 2019 DragonRuby LLC + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/samples/03_rendering_sprites/04_color_and_rotation/replay.txt b/samples/03_rendering_sprites/04_color_and_rotation/replay.txt new file mode 100644 index 0000000..a88fc4e --- /dev/null +++ b/samples/03_rendering_sprites/04_color_and_rotation/replay.txt @@ -0,0 +1,891 @@ +replay_version 2.0 +stopped_at 1251 +seed 100 +recorded_at Sun Sep 29 22:24:17 2019 +[:left_analog_x_player_1, -3000, 0, 1, 1, 104] +[:left_analog_x_player_1, -6000, 0, 1, 2, 105] +[:left_analog_x_player_1, -7000, 0, 1, 3, 106] +[:left_analog_x_player_1, -8000, 0, 1, 4, 107] +[:left_analog_x_player_1, -10000, 0, 1, 5, 108] +[:left_analog_y_player_1, 1000, 0, 1, 6, 108] +[:left_analog_x_player_1, -12000, 0, 1, 7, 109] +[:left_analog_y_player_1, 2000, 0, 1, 8, 109] +[:left_analog_x_player_1, -13000, 0, 1, 9, 110] +[:left_analog_x_player_1, -14000, 0, 1, 10, 111] +[:left_analog_y_player_1, 3000, 0, 1, 11, 113] +[:left_analog_x_player_1, -15000, 0, 1, 12, 114] +[:left_analog_x_player_1, -16000, 0, 1, 13, 121] +[:left_analog_x_player_1, -17000, 0, 1, 14, 123] +[:left_analog_x_player_1, -18000, 0, 1, 15, 124] +[:left_analog_x_player_1, -19000, 0, 1, 16, 125] +[:left_analog_x_player_1, -20000, 0, 1, 17, 127] +[:key_down_player_one, 3, 0, 1, 18, 128] +[:key_held_player_one, 3, 0, 1, 19, 129] +[:key_held_player_one, 3, 0, 1, 20, 130] +[:key_held_player_one, 3, 0, 1, 21, 131] +[:key_held_player_one, 3, 0, 1, 22, 132] +[:key_held_player_one, 3, 0, 1, 23, 133] +[:key_held_player_one, 3, 0, 1, 24, 134] +[:key_held_player_one, 3, 0, 1, 25, 135] +[:key_held_player_one, 3, 0, 1, 26, 136] +[:key_held_player_one, 3, 0, 1, 27, 137] +[:key_held_player_one, 3, 0, 1, 28, 138] +[:key_held_player_one, 3, 0, 1, 29, 139] +[:key_held_player_one, 3, 0, 1, 30, 140] +[:key_held_player_one, 3, 0, 1, 31, 141] +[:key_held_player_one, 3, 0, 1, 32, 142] +[:left_analog_x_player_1, -21000, 0, 1, 33, 142] +[:key_held_player_one, 3, 0, 1, 34, 143] +[:key_held_player_one, 3, 0, 1, 35, 144] +[:left_analog_x_player_1, -22000, 0, 1, 36, 144] +[:key_held_player_one, 3, 0, 1, 37, 145] +[:key_held_player_one, 3, 0, 1, 38, 146] +[:key_held_player_one, 3, 0, 1, 39, 147] +[:left_analog_x_player_1, -23000, 0, 1, 40, 147] +[:key_held_player_one, 3, 0, 1, 41, 148] +[:left_analog_x_player_1, -24000, 0, 1, 42, 148] +[:key_held_player_one, 3, 0, 1, 43, 149] +[:left_analog_x_player_1, -26000, 0, 1, 44, 149] +[:key_held_player_one, 3, 0, 1, 45, 150] +[:left_analog_x_player_1, -27000, 0, 1, 46, 150] +[:key_held_player_one, 3, 0, 1, 47, 151] +[:left_analog_x_player_1, -30000, 0, 1, 48, 151] +[:key_held_player_one, 3, 0, 1, 49, 152] +[:left_analog_x_player_1, -31000, 0, 1, 50, 152] +[:key_held_player_one, 3, 0, 1, 51, 153] +[:left_analog_x_player_1, -32000, 0, 1, 52, 153] +[:key_held_player_one, 3, 0, 1, 53, 154] +[:key_held_player_one, 3, 0, 1, 54, 155] +[:key_held_player_one, 3, 0, 1, 55, 156] +[:key_held_player_one, 3, 0, 1, 56, 157] +[:key_held_player_one, 3, 0, 1, 57, 158] +[:key_held_player_one, 3, 0, 1, 58, 159] +[:key_held_player_one, 3, 0, 1, 59, 160] +[:key_held_player_one, 3, 0, 1, 60, 161] +[:key_held_player_one, 3, 0, 1, 61, 162] +[:left_analog_y_player_1, 2000, 0, 1, 62, 162] +[:key_held_player_one, 3, 0, 1, 63, 163] +[:key_held_player_one, 3, 0, 1, 64, 164] +[:key_held_player_one, 3, 0, 1, 65, 165] +[:key_held_player_one, 3, 0, 1, 66, 166] +[:key_held_player_one, 3, 0, 1, 67, 167] +[:key_held_player_one, 3, 0, 1, 68, 168] +[:key_held_player_one, 3, 0, 1, 69, 169] +[:key_held_player_one, 3, 0, 1, 70, 170] +[:key_held_player_one, 3, 0, 1, 71, 171] +[:key_held_player_one, 3, 0, 1, 72, 172] +[:key_held_player_one, 3, 0, 1, 73, 173] +[:key_held_player_one, 3, 0, 1, 74, 174] +[:key_held_player_one, 3, 0, 1, 75, 175] +[:key_held_player_one, 3, 0, 1, 76, 176] +[:key_held_player_one, 3, 0, 1, 77, 177] +[:key_held_player_one, 3, 0, 1, 78, 178] +[:key_held_player_one, 3, 0, 1, 79, 179] +[:key_held_player_one, 3, 0, 1, 80, 180] +[:key_held_player_one, 3, 0, 1, 81, 181] +[:key_held_player_one, 3, 0, 1, 82, 182] +[:key_held_player_one, 3, 0, 1, 83, 183] +[:key_held_player_one, 3, 0, 1, 84, 184] +[:key_held_player_one, 3, 0, 1, 85, 185] +[:key_held_player_one, 3, 0, 1, 86, 186] +[:key_held_player_one, 3, 0, 1, 87, 187] +[:key_held_player_one, 3, 0, 1, 88, 188] +[:key_held_player_one, 3, 0, 1, 89, 189] +[:key_held_player_one, 3, 0, 1, 90, 190] +[:key_held_player_one, 3, 0, 1, 91, 191] +[:key_held_player_one, 3, 0, 1, 92, 192] +[:key_held_player_one, 3, 0, 1, 93, 193] +[:key_held_player_one, 3, 0, 1, 94, 194] +[:key_held_player_one, 3, 0, 1, 95, 195] +[:key_held_player_one, 3, 0, 1, 96, 196] +[:key_held_player_one, 3, 0, 1, 97, 197] +[:key_held_player_one, 3, 0, 1, 98, 198] +[:key_held_player_one, 3, 0, 1, 99, 199] +[:key_held_player_one, 3, 0, 1, 100, 200] +[:key_held_player_one, 3, 0, 1, 101, 201] +[:key_held_player_one, 3, 0, 1, 102, 202] +[:key_held_player_one, 3, 0, 1, 103, 203] +[:key_held_player_one, 3, 0, 1, 104, 204] +[:key_held_player_one, 3, 0, 1, 105, 205] +[:key_held_player_one, 3, 0, 1, 106, 206] +[:key_held_player_one, 3, 0, 1, 107, 207] +[:key_held_player_one, 3, 0, 1, 108, 208] +[:key_held_player_one, 3, 0, 1, 109, 209] +[:key_held_player_one, 3, 0, 1, 110, 210] +[:key_held_player_one, 3, 0, 1, 111, 211] +[:key_held_player_one, 3, 0, 1, 112, 212] +[:key_held_player_one, 3, 0, 1, 113, 213] +[:key_held_player_one, 3, 0, 1, 114, 214] +[:key_held_player_one, 3, 0, 1, 115, 215] +[:key_held_player_one, 3, 0, 1, 116, 216] +[:key_held_player_one, 3, 0, 1, 117, 217] +[:key_held_player_one, 3, 0, 1, 118, 218] +[:key_held_player_one, 3, 0, 1, 119, 219] +[:key_held_player_one, 3, 0, 1, 120, 220] +[:key_held_player_one, 3, 0, 1, 121, 221] +[:key_held_player_one, 3, 0, 1, 122, 222] +[:key_held_player_one, 3, 0, 1, 123, 223] +[:key_held_player_one, 3, 0, 1, 124, 224] +[:key_held_player_one, 3, 0, 1, 125, 225] +[:key_held_player_one, 3, 0, 1, 126, 226] +[:key_held_player_one, 3, 0, 1, 127, 227] +[:key_held_player_one, 3, 0, 1, 128, 228] +[:key_held_player_one, 3, 0, 1, 129, 229] +[:key_held_player_one, 3, 0, 1, 130, 230] +[:left_analog_y_player_1, 3000, 0, 1, 131, 230] +[:key_held_player_one, 3, 0, 1, 132, 231] +[:key_held_player_one, 3, 0, 1, 133, 232] +[:key_held_player_one, 3, 0, 1, 134, 233] +[:key_held_player_one, 3, 0, 1, 135, 234] +[:key_held_player_one, 3, 0, 1, 136, 235] +[:key_held_player_one, 3, 0, 1, 137, 236] +[:key_held_player_one, 3, 0, 1, 138, 237] +[:key_held_player_one, 3, 0, 1, 139, 238] +[:key_held_player_one, 3, 0, 1, 140, 239] +[:key_held_player_one, 3, 0, 1, 141, 240] +[:key_held_player_one, 3, 0, 1, 142, 241] +[:key_held_player_one, 3, 0, 1, 143, 242] +[:key_held_player_one, 3, 0, 1, 144, 243] +[:key_held_player_one, 3, 0, 1, 145, 244] +[:key_held_player_one, 3, 0, 1, 146, 245] +[:key_held_player_one, 3, 0, 1, 147, 246] +[:key_held_player_one, 3, 0, 1, 148, 247] +[:key_held_player_one, 3, 0, 1, 149, 248] +[:key_held_player_one, 3, 0, 1, 150, 249] +[:key_held_player_one, 3, 0, 1, 151, 250] +[:key_held_player_one, 3, 0, 1, 152, 251] +[:key_held_player_one, 3, 0, 1, 153, 252] +[:key_held_player_one, 3, 0, 1, 154, 253] +[:key_held_player_one, 3, 0, 1, 155, 254] +[:key_held_player_one, 3, 0, 1, 156, 255] +[:key_held_player_one, 3, 0, 1, 157, 256] +[:key_held_player_one, 3, 0, 1, 158, 257] +[:key_held_player_one, 3, 0, 1, 159, 258] +[:key_held_player_one, 3, 0, 1, 160, 259] +[:key_held_player_one, 3, 0, 1, 161, 260] +[:key_held_player_one, 3, 0, 1, 162, 261] +[:key_held_player_one, 3, 0, 1, 163, 262] +[:key_held_player_one, 3, 0, 1, 164, 263] +[:key_held_player_one, 3, 0, 1, 165, 264] +[:key_held_player_one, 3, 0, 1, 166, 265] +[:key_held_player_one, 3, 0, 1, 167, 266] +[:key_held_player_one, 3, 0, 1, 168, 267] +[:key_held_player_one, 3, 0, 1, 169, 268] +[:key_held_player_one, 3, 0, 1, 170, 269] +[:key_held_player_one, 3, 0, 1, 171, 270] +[:key_held_player_one, 3, 0, 1, 172, 271] +[:key_held_player_one, 3, 0, 1, 173, 272] +[:key_held_player_one, 3, 0, 1, 174, 273] +[:key_held_player_one, 3, 0, 1, 175, 274] +[:key_held_player_one, 3, 0, 1, 176, 275] +[:key_held_player_one, 3, 0, 1, 177, 276] +[:key_held_player_one, 3, 0, 1, 178, 277] +[:key_held_player_one, 3, 0, 1, 179, 278] +[:key_held_player_one, 3, 0, 1, 180, 279] +[:key_held_player_one, 3, 0, 1, 181, 280] +[:key_held_player_one, 3, 0, 1, 182, 281] +[:key_held_player_one, 3, 0, 1, 183, 282] +[:key_held_player_one, 3, 0, 1, 184, 283] +[:key_held_player_one, 3, 0, 1, 185, 284] +[:key_held_player_one, 3, 0, 1, 186, 285] +[:key_held_player_one, 3, 0, 1, 187, 286] +[:key_held_player_one, 3, 0, 1, 188, 287] +[:key_held_player_one, 3, 0, 1, 189, 288] +[:key_held_player_one, 3, 0, 1, 190, 289] +[:key_held_player_one, 3, 0, 1, 191, 290] +[:key_held_player_one, 3, 0, 1, 192, 291] +[:key_held_player_one, 3, 0, 1, 193, 292] +[:key_held_player_one, 3, 0, 1, 194, 293] +[:key_held_player_one, 3, 0, 1, 195, 294] +[:key_held_player_one, 3, 0, 1, 196, 295] +[:key_held_player_one, 3, 0, 1, 197, 296] +[:key_held_player_one, 3, 0, 1, 198, 297] +[:key_held_player_one, 3, 0, 1, 199, 298] +[:key_held_player_one, 3, 0, 1, 200, 299] +[:key_held_player_one, 3, 0, 1, 201, 300] +[:key_held_player_one, 3, 0, 1, 202, 301] +[:key_held_player_one, 3, 0, 1, 203, 302] +[:key_held_player_one, 3, 0, 1, 204, 303] +[:key_held_player_one, 3, 0, 1, 205, 304] +[:key_held_player_one, 3, 0, 1, 206, 305] +[:key_held_player_one, 3, 0, 1, 207, 306] +[:key_held_player_one, 3, 0, 1, 208, 307] +[:key_held_player_one, 3, 0, 1, 209, 308] +[:key_held_player_one, 3, 0, 1, 210, 309] +[:key_held_player_one, 3, 0, 1, 211, 310] +[:key_held_player_one, 3, 0, 1, 212, 311] +[:key_held_player_one, 3, 0, 1, 213, 312] +[:key_held_player_one, 3, 0, 1, 214, 313] +[:key_held_player_one, 3, 0, 1, 215, 314] +[:key_held_player_one, 3, 0, 1, 216, 315] +[:key_held_player_one, 3, 0, 1, 217, 316] +[:key_held_player_one, 3, 0, 1, 218, 317] +[:key_held_player_one, 3, 0, 1, 219, 318] +[:key_held_player_one, 3, 0, 1, 220, 319] +[:key_held_player_one, 3, 0, 1, 221, 320] +[:key_held_player_one, 3, 0, 1, 222, 321] +[:key_held_player_one, 3, 0, 1, 223, 322] +[:key_held_player_one, 3, 0, 1, 224, 323] +[:key_held_player_one, 3, 0, 1, 225, 324] +[:key_held_player_one, 3, 0, 1, 226, 325] +[:key_held_player_one, 3, 0, 1, 227, 326] +[:key_held_player_one, 3, 0, 1, 228, 327] +[:key_held_player_one, 3, 0, 1, 229, 328] +[:key_held_player_one, 3, 0, 1, 230, 329] +[:key_held_player_one, 3, 0, 1, 231, 330] +[:key_held_player_one, 3, 0, 1, 232, 331] +[:key_held_player_one, 3, 0, 1, 233, 332] +[:key_held_player_one, 3, 0, 1, 234, 333] +[:key_held_player_one, 3, 0, 1, 235, 334] +[:key_held_player_one, 3, 0, 1, 236, 335] +[:key_held_player_one, 3, 0, 1, 237, 336] +[:key_held_player_one, 3, 0, 1, 238, 337] +[:key_held_player_one, 3, 0, 1, 239, 338] +[:key_held_player_one, 3, 0, 1, 240, 339] +[:key_held_player_one, 3, 0, 1, 241, 340] +[:key_held_player_one, 3, 0, 1, 242, 341] +[:key_held_player_one, 3, 0, 1, 243, 342] +[:key_held_player_one, 3, 0, 1, 244, 343] +[:key_held_player_one, 3, 0, 1, 245, 344] +[:key_held_player_one, 3, 0, 1, 246, 345] +[:key_held_player_one, 3, 0, 1, 247, 346] +[:key_held_player_one, 3, 0, 1, 248, 347] +[:key_held_player_one, 3, 0, 1, 249, 348] +[:key_held_player_one, 3, 0, 1, 250, 349] +[:key_held_player_one, 3, 0, 1, 251, 350] +[:key_held_player_one, 3, 0, 1, 252, 351] +[:key_held_player_one, 3, 0, 1, 253, 352] +[:key_held_player_one, 3, 0, 1, 254, 353] +[:key_held_player_one, 3, 0, 1, 255, 354] +[:key_held_player_one, 3, 0, 1, 256, 355] +[:key_held_player_one, 3, 0, 1, 257, 356] +[:key_held_player_one, 3, 0, 1, 258, 357] +[:key_held_player_one, 3, 0, 1, 259, 358] +[:key_held_player_one, 3, 0, 1, 260, 359] +[:key_held_player_one, 3, 0, 1, 261, 360] +[:key_held_player_one, 3, 0, 1, 262, 361] +[:key_held_player_one, 3, 0, 1, 263, 362] +[:key_held_player_one, 3, 0, 1, 264, 363] +[:key_held_player_one, 3, 0, 1, 265, 364] +[:key_held_player_one, 3, 0, 1, 266, 365] +[:key_held_player_one, 3, 0, 1, 267, 366] +[:key_held_player_one, 3, 0, 1, 268, 367] +[:key_held_player_one, 3, 0, 1, 269, 368] +[:key_held_player_one, 3, 0, 1, 270, 369] +[:key_held_player_one, 3, 0, 1, 271, 370] +[:key_held_player_one, 3, 0, 1, 272, 371] +[:key_held_player_one, 3, 0, 1, 273, 372] +[:key_held_player_one, 3, 0, 1, 274, 373] +[:key_held_player_one, 3, 0, 1, 275, 374] +[:key_held_player_one, 3, 0, 1, 276, 375] +[:key_held_player_one, 3, 0, 1, 277, 376] +[:key_held_player_one, 3, 0, 1, 278, 377] +[:key_held_player_one, 3, 0, 1, 279, 378] +[:key_held_player_one, 3, 0, 1, 280, 379] +[:left_analog_y_player_1, 2000, 0, 1, 281, 379] +[:key_held_player_one, 3, 0, 1, 282, 380] +[:left_analog_y_player_1, 0, 0, 1, 283, 380] +[:key_held_player_one, 3, 0, 1, 284, 381] +[:left_analog_x_player_1, -28000, 0, 1, 285, 381] +[:key_held_player_one, 3, 0, 1, 286, 382] +[:left_analog_x_player_1, -20000, 0, 1, 287, 382] +[:key_held_player_one, 3, 0, 1, 288, 383] +[:left_analog_x_player_1, 0, 0, 1, 289, 383] +[:key_up_player_one, 3, 0, 1, 290, 384] +[:right_analog_x_player_1, 2000, 0, 1, 291, 391] +[:right_analog_x_player_1, 6000, 0, 1, 292, 392] +[:right_analog_x_player_1, 8000, 0, 1, 293, 393] +[:right_analog_x_player_1, 11000, 0, 1, 294, 394] +[:right_analog_x_player_1, 13000, 0, 1, 295, 395] +[:right_analog_x_player_1, 15000, 0, 1, 296, 396] +[:right_analog_x_player_1, 18000, 0, 1, 297, 397] +[:right_analog_x_player_1, 19000, 0, 1, 298, 398] +[:right_analog_x_player_1, 20000, 0, 1, 299, 400] +[:key_down_player_one, 4, 0, 1, 300, 401] +[:key_held_player_one, 4, 0, 1, 301, 402] +[:key_held_player_one, 4, 0, 1, 302, 403] +[:key_held_player_one, 4, 0, 1, 303, 404] +[:key_held_player_one, 4, 0, 1, 304, 405] +[:key_held_player_one, 4, 0, 1, 305, 406] +[:key_held_player_one, 4, 0, 1, 306, 407] +[:key_held_player_one, 4, 0, 1, 307, 408] +[:key_held_player_one, 4, 0, 1, 308, 409] +[:key_held_player_one, 4, 0, 1, 309, 410] +[:key_held_player_one, 4, 0, 1, 310, 411] +[:key_held_player_one, 4, 0, 1, 311, 412] +[:key_held_player_one, 4, 0, 1, 312, 413] +[:key_held_player_one, 4, 0, 1, 313, 414] +[:key_held_player_one, 4, 0, 1, 314, 415] +[:right_analog_x_player_1, 21000, 0, 1, 315, 415] +[:key_held_player_one, 4, 0, 1, 316, 416] +[:key_held_player_one, 4, 0, 1, 317, 417] +[:key_held_player_one, 4, 0, 1, 318, 418] +[:right_analog_x_player_1, 22000, 0, 1, 319, 418] +[:key_held_player_one, 4, 0, 1, 320, 419] +[:key_held_player_one, 4, 0, 1, 321, 420] +[:key_held_player_one, 4, 0, 1, 322, 421] +[:right_analog_x_player_1, 24000, 0, 1, 323, 421] +[:key_held_player_one, 4, 0, 1, 324, 422] +[:right_analog_x_player_1, 25000, 0, 1, 325, 422] +[:key_held_player_one, 4, 0, 1, 326, 423] +[:right_analog_x_player_1, 26000, 0, 1, 327, 423] +[:key_held_player_one, 4, 0, 1, 328, 424] +[:key_held_player_one, 4, 0, 1, 329, 425] +[:right_analog_x_player_1, 27000, 0, 1, 330, 425] +[:key_held_player_one, 4, 0, 1, 331, 426] +[:right_analog_x_player_1, 29000, 0, 1, 332, 426] +[:key_held_player_one, 4, 0, 1, 333, 427] +[:right_analog_x_player_1, 31000, 0, 1, 334, 427] +[:key_held_player_one, 4, 0, 1, 335, 428] +[:right_analog_x_player_1, 32000, 0, 1, 336, 428] +[:key_held_player_one, 4, 0, 1, 337, 429] +[:key_held_player_one, 4, 0, 1, 338, 430] +[:key_held_player_one, 4, 0, 1, 339, 431] +[:key_held_player_one, 4, 0, 1, 340, 432] +[:key_held_player_one, 4, 0, 1, 341, 433] +[:key_held_player_one, 4, 0, 1, 342, 434] +[:key_held_player_one, 4, 0, 1, 343, 435] +[:key_held_player_one, 4, 0, 1, 344, 436] +[:key_held_player_one, 4, 0, 1, 345, 437] +[:key_held_player_one, 4, 0, 1, 346, 438] +[:key_held_player_one, 4, 0, 1, 347, 439] +[:key_held_player_one, 4, 0, 1, 348, 440] +[:key_held_player_one, 4, 0, 1, 349, 441] +[:key_held_player_one, 4, 0, 1, 350, 442] +[:key_held_player_one, 4, 0, 1, 351, 443] +[:key_held_player_one, 4, 0, 1, 352, 444] +[:key_held_player_one, 4, 0, 1, 353, 445] +[:key_held_player_one, 4, 0, 1, 354, 446] +[:key_held_player_one, 4, 0, 1, 355, 447] +[:key_held_player_one, 4, 0, 1, 356, 448] +[:key_held_player_one, 4, 0, 1, 357, 449] +[:key_held_player_one, 4, 0, 1, 358, 450] +[:key_held_player_one, 4, 0, 1, 359, 451] +[:key_held_player_one, 4, 0, 1, 360, 452] +[:key_held_player_one, 4, 0, 1, 361, 453] +[:key_held_player_one, 4, 0, 1, 362, 454] +[:key_held_player_one, 4, 0, 1, 363, 455] +[:key_held_player_one, 4, 0, 1, 364, 456] +[:key_held_player_one, 4, 0, 1, 365, 457] +[:right_analog_x_player_1, 31000, 0, 1, 366, 457] +[:key_held_player_one, 4, 0, 1, 367, 458] +[:right_analog_x_player_1, 22000, 0, 1, 368, 458] +[:key_held_player_one, 4, 0, 1, 369, 459] +[:right_analog_x_player_1, 3000, 0, 1, 370, 459] +[:key_up_player_one, 4, 0, 1, 371, 460] +[:right_analog_x_player_1, 0, 0, 1, 372, 460] +[:right_analog_x_player_1, -1000, 0, 1, 373, 494] +[:right_analog_x_player_1, -2000, 0, 1, 374, 496] +[:right_analog_x_player_1, -4000, 0, 1, 375, 497] +[:right_analog_x_player_1, -8000, 0, 1, 376, 498] +[:right_analog_x_player_1, -13000, 0, 1, 377, 499] +[:right_analog_x_player_1, -18000, 0, 1, 378, 500] +[:right_analog_y_player_1, -1000, 0, 1, 379, 500] +[:right_analog_x_player_1, -23000, 0, 1, 380, 501] +[:right_analog_y_player_1, -2000, 0, 1, 381, 501] +[:key_down_player_one, 3, 0, 1, 382, 502] +[:right_analog_x_player_1, -27000, 0, 1, 383, 502] +[:right_analog_y_player_1, -3000, 0, 1, 384, 502] +[:key_held_player_one, 3, 0, 1, 385, 503] +[:right_analog_x_player_1, -32000, 0, 1, 386, 503] +[:right_analog_y_player_1, -4000, 0, 1, 387, 503] +[:key_held_player_one, 3, 0, 1, 388, 504] +[:key_held_player_one, 3, 0, 1, 389, 505] +[:key_held_player_one, 3, 0, 1, 390, 506] +[:key_held_player_one, 3, 0, 1, 391, 507] +[:key_held_player_one, 3, 0, 1, 392, 508] +[:key_held_player_one, 3, 0, 1, 393, 509] +[:key_held_player_one, 3, 0, 1, 394, 510] +[:key_held_player_one, 3, 0, 1, 395, 511] +[:key_held_player_one, 3, 0, 1, 396, 512] +[:key_held_player_one, 3, 0, 1, 397, 513] +[:key_held_player_one, 3, 0, 1, 398, 514] +[:key_held_player_one, 3, 0, 1, 399, 515] +[:key_held_player_one, 3, 0, 1, 400, 516] +[:right_analog_x_player_1, -31000, 0, 1, 401, 516] +[:right_analog_y_player_1, -7000, 0, 1, 402, 516] +[:key_held_player_one, 3, 0, 1, 403, 517] +[:right_analog_x_player_1, -21000, 0, 1, 404, 517] +[:right_analog_y_player_1, -8000, 0, 1, 405, 517] +[:key_held_player_one, 3, 0, 1, 406, 518] +[:right_analog_x_player_1, -9000, 0, 1, 407, 518] +[:key_up_player_one, 3, 0, 1, 408, 519] +[:right_analog_x_player_1, -2000, 0, 1, 409, 519] +[:right_analog_y_player_1, -2000, 0, 1, 410, 519] +[:right_analog_x_player_1, 0, 0, 1, 411, 520] +[:right_analog_y_player_1, 0, 0, 1, 412, 520] +[:left_analog_x_player_1, 1000, 0, 1, 413, 523] +[:left_analog_x_player_1, 3000, 0, 1, 414, 524] +[:left_analog_x_player_1, 5000, 0, 1, 415, 525] +[:left_analog_x_player_1, 8000, 0, 1, 416, 526] +[:left_analog_x_player_1, 12000, 0, 1, 417, 527] +[:left_analog_x_player_1, 15000, 0, 1, 418, 528] +[:left_analog_x_player_1, 18000, 0, 1, 419, 529] +[:left_analog_x_player_1, 19000, 0, 1, 420, 530] +[:left_analog_x_player_1, 20000, 0, 1, 421, 531] +[:key_down_player_one, 4, 0, 1, 422, 532] +[:left_analog_x_player_1, 21000, 0, 1, 423, 532] +[:key_held_player_one, 4, 0, 1, 424, 533] +[:key_held_player_one, 4, 0, 1, 425, 534] +[:key_held_player_one, 4, 0, 1, 426, 535] +[:key_held_player_one, 4, 0, 1, 427, 536] +[:key_held_player_one, 4, 0, 1, 428, 537] +[:key_held_player_one, 4, 0, 1, 429, 538] +[:key_held_player_one, 4, 0, 1, 430, 539] +[:left_analog_x_player_1, 22000, 0, 1, 431, 539] +[:key_held_player_one, 4, 0, 1, 432, 540] +[:left_analog_x_player_1, 23000, 0, 1, 433, 540] +[:left_analog_y_player_1, 2000, 0, 1, 434, 540] +[:key_held_player_one, 4, 0, 1, 435, 541] +[:key_held_player_one, 4, 0, 1, 436, 542] +[:left_analog_x_player_1, 24000, 0, 1, 437, 542] +[:left_analog_y_player_1, 3000, 0, 1, 438, 542] +[:key_held_player_one, 4, 0, 1, 439, 543] +[:left_analog_x_player_1, 26000, 0, 1, 440, 543] +[:key_held_player_one, 4, 0, 1, 441, 544] +[:left_analog_x_player_1, 27000, 0, 1, 442, 544] +[:key_held_player_one, 4, 0, 1, 443, 545] +[:key_held_player_one, 4, 0, 1, 444, 546] +[:key_held_player_one, 4, 0, 1, 445, 547] +[:key_held_player_one, 4, 0, 1, 446, 548] +[:key_held_player_one, 4, 0, 1, 447, 549] +[:key_held_player_one, 4, 0, 1, 448, 550] +[:key_held_player_one, 4, 0, 1, 449, 551] +[:key_held_player_one, 4, 0, 1, 450, 552] +[:key_held_player_one, 4, 0, 1, 451, 553] +[:key_held_player_one, 4, 0, 1, 452, 554] +[:key_held_player_one, 4, 0, 1, 453, 555] +[:key_held_player_one, 4, 0, 1, 454, 556] +[:key_held_player_one, 4, 0, 1, 455, 557] +[:key_held_player_one, 4, 0, 1, 456, 558] +[:key_held_player_one, 4, 0, 1, 457, 559] +[:key_held_player_one, 4, 0, 1, 458, 560] +[:key_held_player_one, 4, 0, 1, 459, 561] +[:key_held_player_one, 4, 0, 1, 460, 562] +[:key_held_player_one, 4, 0, 1, 461, 563] +[:key_held_player_one, 4, 0, 1, 462, 564] +[:key_held_player_one, 4, 0, 1, 463, 565] +[:key_held_player_one, 4, 0, 1, 464, 566] +[:key_held_player_one, 4, 0, 1, 465, 567] +[:key_held_player_one, 4, 0, 1, 466, 568] +[:key_held_player_one, 4, 0, 1, 467, 569] +[:key_held_player_one, 4, 0, 1, 468, 570] +[:key_held_player_one, 4, 0, 1, 469, 571] +[:key_held_player_one, 4, 0, 1, 470, 572] +[:key_held_player_one, 4, 0, 1, 471, 573] +[:key_held_player_one, 4, 0, 1, 472, 574] +[:key_held_player_one, 4, 0, 1, 473, 575] +[:key_held_player_one, 4, 0, 1, 474, 576] +[:key_held_player_one, 4, 0, 1, 475, 577] +[:key_held_player_one, 4, 0, 1, 476, 578] +[:key_held_player_one, 4, 0, 1, 477, 579] +[:key_held_player_one, 4, 0, 1, 478, 580] +[:key_held_player_one, 4, 0, 1, 479, 581] +[:left_analog_x_player_1, 28000, 0, 1, 480, 581] +[:left_analog_y_player_1, 4000, 0, 1, 481, 581] +[:key_held_player_one, 4, 0, 1, 482, 582] +[:left_analog_x_player_1, 30000, 0, 1, 483, 582] +[:left_analog_y_player_1, 5000, 0, 1, 484, 582] +[:key_held_player_one, 4, 0, 1, 485, 583] +[:left_analog_x_player_1, 32000, 0, 1, 486, 583] +[:left_analog_y_player_1, 7000, 0, 1, 487, 583] +[:key_held_player_one, 4, 0, 1, 488, 584] +[:key_held_player_one, 4, 0, 1, 489, 585] +[:key_held_player_one, 4, 0, 1, 490, 586] +[:key_held_player_one, 4, 0, 1, 491, 587] +[:key_held_player_one, 4, 0, 1, 492, 588] +[:key_held_player_one, 4, 0, 1, 493, 589] +[:key_held_player_one, 4, 0, 1, 494, 590] +[:key_held_player_one, 4, 0, 1, 495, 591] +[:key_held_player_one, 4, 0, 1, 496, 592] +[:key_held_player_one, 4, 0, 1, 497, 593] +[:key_held_player_one, 4, 0, 1, 498, 594] +[:key_held_player_one, 4, 0, 1, 499, 595] +[:key_held_player_one, 4, 0, 1, 500, 596] +[:key_held_player_one, 4, 0, 1, 501, 597] +[:key_held_player_one, 4, 0, 1, 502, 598] +[:key_held_player_one, 4, 0, 1, 503, 599] +[:key_held_player_one, 4, 0, 1, 504, 600] +[:key_held_player_one, 4, 0, 1, 505, 601] +[:key_held_player_one, 4, 0, 1, 506, 602] +[:key_held_player_one, 4, 0, 1, 507, 603] +[:key_held_player_one, 4, 0, 1, 508, 604] +[:key_held_player_one, 4, 0, 1, 509, 605] +[:key_held_player_one, 4, 0, 1, 510, 606] +[:key_held_player_one, 4, 0, 1, 511, 607] +[:key_held_player_one, 4, 0, 1, 512, 608] +[:key_held_player_one, 4, 0, 1, 513, 609] +[:key_held_player_one, 4, 0, 1, 514, 610] +[:key_held_player_one, 4, 0, 1, 515, 611] +[:key_held_player_one, 4, 0, 1, 516, 612] +[:key_held_player_one, 4, 0, 1, 517, 613] +[:key_held_player_one, 4, 0, 1, 518, 614] +[:key_held_player_one, 4, 0, 1, 519, 615] +[:key_held_player_one, 4, 0, 1, 520, 616] +[:key_held_player_one, 4, 0, 1, 521, 617] +[:key_held_player_one, 4, 0, 1, 522, 618] +[:key_held_player_one, 4, 0, 1, 523, 619] +[:key_held_player_one, 4, 0, 1, 524, 620] +[:key_held_player_one, 4, 0, 1, 525, 621] +[:key_held_player_one, 4, 0, 1, 526, 622] +[:key_held_player_one, 4, 0, 1, 527, 623] +[:key_held_player_one, 4, 0, 1, 528, 624] +[:key_held_player_one, 4, 0, 1, 529, 625] +[:key_held_player_one, 4, 0, 1, 530, 626] +[:key_held_player_one, 4, 0, 1, 531, 627] +[:key_held_player_one, 4, 0, 1, 532, 628] +[:key_held_player_one, 4, 0, 1, 533, 629] +[:key_held_player_one, 4, 0, 1, 534, 630] +[:key_held_player_one, 4, 0, 1, 535, 631] +[:left_analog_y_player_1, 8000, 0, 1, 536, 631] +[:key_held_player_one, 4, 0, 1, 537, 632] +[:key_held_player_one, 4, 0, 1, 538, 633] +[:key_held_player_one, 4, 0, 1, 539, 634] +[:key_held_player_one, 4, 0, 1, 540, 635] +[:key_held_player_one, 4, 0, 1, 541, 636] +[:key_held_player_one, 4, 0, 1, 542, 637] +[:key_held_player_one, 4, 0, 1, 543, 638] +[:key_held_player_one, 4, 0, 1, 544, 639] +[:key_held_player_one, 4, 0, 1, 545, 640] +[:key_held_player_one, 4, 0, 1, 546, 641] +[:key_held_player_one, 4, 0, 1, 547, 642] +[:key_held_player_one, 4, 0, 1, 548, 643] +[:key_held_player_one, 4, 0, 1, 549, 644] +[:left_analog_y_player_1, 9000, 0, 1, 550, 644] +[:key_held_player_one, 4, 0, 1, 551, 645] +[:left_analog_y_player_1, 8000, 0, 1, 552, 645] +[:key_held_player_one, 4, 0, 1, 553, 646] +[:left_analog_x_player_1, 29000, 0, 1, 554, 646] +[:left_analog_y_player_1, 6000, 0, 1, 555, 646] +[:key_held_player_one, 4, 0, 1, 556, 647] +[:left_analog_x_player_1, 25000, 0, 1, 557, 647] +[:left_analog_y_player_1, 4000, 0, 1, 558, 647] +[:key_held_player_one, 4, 0, 1, 559, 648] +[:left_analog_x_player_1, 17000, 0, 1, 560, 648] +[:left_analog_y_player_1, 2000, 0, 1, 561, 648] +[:key_up_player_one, 4, 0, 1, 562, 649] +[:left_analog_x_player_1, 11000, 0, 1, 563, 649] +[:left_analog_y_player_1, 0, 0, 1, 564, 649] +[:left_analog_x_player_1, 0, 0, 1, 565, 650] +[:left_analog_x_player_1, -2000, 0, 1, 566, 684] +[:left_analog_x_player_1, -5000, 0, 1, 567, 685] +[:left_analog_x_player_1, -8000, 0, 1, 568, 686] +[:left_analog_x_player_1, -12000, 0, 1, 569, 687] +[:left_analog_x_player_1, -15000, 0, 1, 570, 688] +[:left_analog_x_player_1, -18000, 0, 1, 571, 689] +[:left_analog_x_player_1, -21000, 0, 1, 572, 690] +[:key_down_player_one, 3, 0, 1, 573, 691] +[:left_analog_x_player_1, -22000, 0, 1, 574, 691] +[:key_held_player_one, 3, 0, 1, 575, 692] +[:left_analog_x_player_1, -23000, 0, 1, 576, 692] +[:key_held_player_one, 3, 0, 1, 577, 693] +[:key_held_player_one, 3, 0, 1, 578, 694] +[:key_held_player_one, 3, 0, 1, 579, 695] +[:left_analog_x_player_1, -22000, 0, 1, 580, 695] +[:key_held_player_one, 3, 0, 1, 581, 696] +[:key_held_player_one, 3, 0, 1, 582, 697] +[:left_analog_y_player_1, 1000, 0, 1, 583, 697] +[:key_held_player_one, 3, 0, 1, 584, 698] +[:key_held_player_one, 3, 0, 1, 585, 699] +[:key_held_player_one, 3, 0, 1, 586, 700] +[:key_held_player_one, 3, 0, 1, 587, 701] +[:key_held_player_one, 3, 0, 1, 588, 702] +[:left_analog_x_player_1, -23000, 0, 1, 589, 702] +[:key_held_player_one, 3, 0, 1, 590, 703] +[:left_analog_x_player_1, -24000, 0, 1, 591, 703] +[:key_held_player_one, 3, 0, 1, 592, 704] +[:key_held_player_one, 3, 0, 1, 593, 705] +[:key_held_player_one, 3, 0, 1, 594, 706] +[:key_held_player_one, 3, 0, 1, 595, 707] +[:key_held_player_one, 3, 0, 1, 596, 708] +[:key_held_player_one, 3, 0, 1, 597, 709] +[:left_analog_x_player_1, -25000, 0, 1, 598, 709] +[:key_held_player_one, 3, 0, 1, 599, 710] +[:left_analog_y_player_1, 2000, 0, 1, 600, 710] +[:key_held_player_one, 3, 0, 1, 601, 711] +[:key_held_player_one, 3, 0, 1, 602, 712] +[:key_held_player_one, 3, 0, 1, 603, 713] +[:key_held_player_one, 3, 0, 1, 604, 714] +[:key_held_player_one, 3, 0, 1, 605, 715] +[:key_held_player_one, 3, 0, 1, 606, 716] +[:key_held_player_one, 3, 0, 1, 607, 717] +[:left_analog_y_player_1, 1000, 0, 1, 608, 717] +[:key_held_player_one, 3, 0, 1, 609, 718] +[:left_analog_y_player_1, 2000, 0, 1, 610, 718] +[:key_held_player_one, 3, 0, 1, 611, 719] +[:key_held_player_one, 3, 0, 1, 612, 720] +[:left_analog_x_player_1, -26000, 0, 1, 613, 720] +[:key_held_player_one, 3, 0, 1, 614, 721] +[:key_held_player_one, 3, 0, 1, 615, 722] +[:key_held_player_one, 3, 0, 1, 616, 723] +[:key_held_player_one, 3, 0, 1, 617, 724] +[:left_analog_x_player_1, -27000, 0, 1, 618, 724] +[:key_held_player_one, 3, 0, 1, 619, 725] +[:key_held_player_one, 3, 0, 1, 620, 726] +[:key_held_player_one, 3, 0, 1, 621, 727] +[:key_held_player_one, 3, 0, 1, 622, 728] +[:key_held_player_one, 3, 0, 1, 623, 729] +[:key_held_player_one, 3, 0, 1, 624, 730] +[:key_held_player_one, 3, 0, 1, 625, 731] +[:key_held_player_one, 3, 0, 1, 626, 732] +[:key_held_player_one, 3, 0, 1, 627, 733] +[:key_held_player_one, 3, 0, 1, 628, 734] +[:key_held_player_one, 3, 0, 1, 629, 735] +[:key_held_player_one, 3, 0, 1, 630, 736] +[:key_held_player_one, 3, 0, 1, 631, 737] +[:key_held_player_one, 3, 0, 1, 632, 738] +[:key_held_player_one, 3, 0, 1, 633, 739] +[:key_held_player_one, 3, 0, 1, 634, 740] +[:key_held_player_one, 3, 0, 1, 635, 741] +[:key_held_player_one, 3, 0, 1, 636, 742] +[:key_held_player_one, 3, 0, 1, 637, 743] +[:key_held_player_one, 3, 0, 1, 638, 744] +[:key_held_player_one, 3, 0, 1, 639, 745] +[:key_held_player_one, 3, 0, 1, 640, 746] +[:key_held_player_one, 3, 0, 1, 641, 747] +[:key_held_player_one, 3, 0, 1, 642, 748] +[:key_held_player_one, 3, 0, 1, 643, 749] +[:key_held_player_one, 3, 0, 1, 644, 750] +[:key_held_player_one, 3, 0, 1, 645, 751] +[:key_held_player_one, 3, 0, 1, 646, 752] +[:key_held_player_one, 3, 0, 1, 647, 753] +[:key_held_player_one, 3, 0, 1, 648, 754] +[:key_held_player_one, 3, 0, 1, 649, 755] +[:key_held_player_one, 3, 0, 1, 650, 756] +[:key_held_player_one, 3, 0, 1, 651, 757] +[:key_held_player_one, 3, 0, 1, 652, 758] +[:key_held_player_one, 3, 0, 1, 653, 759] +[:key_held_player_one, 3, 0, 1, 654, 760] +[:key_held_player_one, 3, 0, 1, 655, 761] +[:key_held_player_one, 3, 0, 1, 656, 762] +[:key_held_player_one, 3, 0, 1, 657, 763] +[:key_held_player_one, 3, 0, 1, 658, 764] +[:key_held_player_one, 3, 0, 1, 659, 765] +[:key_held_player_one, 3, 0, 1, 660, 766] +[:key_held_player_one, 3, 0, 1, 661, 767] +[:key_held_player_one, 3, 0, 1, 662, 768] +[:key_held_player_one, 3, 0, 1, 663, 769] +[:key_held_player_one, 3, 0, 1, 664, 770] +[:key_held_player_one, 3, 0, 1, 665, 771] +[:key_held_player_one, 3, 0, 1, 666, 772] +[:key_held_player_one, 3, 0, 1, 667, 773] +[:key_held_player_one, 3, 0, 1, 668, 774] +[:key_held_player_one, 3, 0, 1, 669, 775] +[:key_held_player_one, 3, 0, 1, 670, 776] +[:left_analog_x_player_1, -26000, 0, 1, 671, 776] +[:key_held_player_one, 3, 0, 1, 672, 777] +[:key_held_player_one, 3, 0, 1, 673, 778] +[:key_held_player_one, 3, 0, 1, 674, 779] +[:key_held_player_one, 3, 0, 1, 675, 780] +[:left_analog_x_player_1, -25000, 0, 1, 676, 780] +[:key_held_player_one, 3, 0, 1, 677, 781] +[:left_analog_x_player_1, -24000, 0, 1, 678, 781] +[:key_held_player_one, 3, 0, 1, 679, 782] +[:key_held_player_one, 3, 0, 1, 680, 783] +[:left_analog_x_player_1, -23000, 0, 1, 681, 783] +[:key_held_player_one, 3, 0, 1, 682, 784] +[:key_held_player_one, 3, 0, 1, 683, 785] +[:left_analog_x_player_1, -22000, 0, 1, 684, 785] +[:left_analog_y_player_1, 3000, 0, 1, 685, 785] +[:key_held_player_one, 3, 0, 1, 686, 786] +[:left_analog_x_player_1, -21000, 0, 1, 687, 786] +[:key_held_player_one, 3, 0, 1, 688, 787] +[:left_analog_x_player_1, -20000, 0, 1, 689, 787] +[:key_held_player_one, 3, 0, 1, 690, 788] +[:key_held_player_one, 3, 0, 1, 691, 789] +[:key_held_player_one, 3, 0, 1, 692, 790] +[:key_held_player_one, 3, 0, 1, 693, 791] +[:left_analog_x_player_1, -19000, 0, 1, 694, 791] +[:key_up_player_one, 3, 0, 1, 695, 792] +[:left_analog_x_player_1, -18000, 0, 1, 696, 792] +[:left_analog_x_player_1, -15000, 0, 1, 697, 793] +[:left_analog_x_player_1, -13000, 0, 1, 698, 794] +[:left_analog_x_player_1, -10000, 0, 1, 699, 795] +[:left_analog_x_player_1, -8000, 0, 1, 700, 796] +[:left_analog_x_player_1, -6000, 0, 1, 701, 797] +[:left_analog_x_player_1, -4000, 0, 1, 702, 798] +[:left_analog_y_player_1, 2000, 0, 1, 703, 798] +[:left_analog_x_player_1, -2000, 0, 1, 704, 799] +[:left_analog_y_player_1, 1000, 0, 1, 705, 799] +[:left_analog_y_player_1, 0, 0, 1, 706, 800] +[:left_analog_x_player_1, -1000, 0, 1, 707, 814] +[:left_analog_x_player_1, 0, 0, 1, 708, 815] +[:left_analog_x_player_1, -1000, 0, 1, 709, 821] +[:left_analog_x_player_1, -2000, 0, 1, 710, 823] +[:left_analog_x_player_1, -4000, 0, 1, 711, 824] +[:left_analog_x_player_1, -6000, 0, 1, 712, 825] +[:left_analog_x_player_1, -8000, 0, 1, 713, 826] +[:left_analog_x_player_1, -9000, 0, 1, 714, 827] +[:left_analog_x_player_1, -10000, 0, 1, 715, 828] +[:left_analog_x_player_1, -11000, 0, 1, 716, 829] +[:left_analog_x_player_1, -10000, 0, 1, 717, 832] +[:left_analog_y_player_1, 2000, 0, 1, 718, 832] +[:left_analog_x_player_1, -8000, 0, 1, 719, 833] +[:left_analog_x_player_1, -3000, 0, 1, 720, 834] +[:left_analog_x_player_1, -1000, 0, 1, 721, 835] +[:left_analog_x_player_1, 0, 0, 1, 722, 836] +[:left_analog_y_player_1, 1000, 0, 1, 723, 836] +[:left_analog_x_player_1, 1000, 0, 1, 724, 841] +[:left_analog_x_player_1, 3000, 0, 1, 725, 842] +[:left_analog_x_player_1, 4000, 0, 1, 726, 843] +[:left_analog_y_player_1, 2000, 0, 1, 727, 843] +[:left_analog_x_player_1, 5000, 0, 1, 728, 844] +[:left_analog_x_player_1, 7000, 0, 1, 729, 845] +[:left_analog_x_player_1, 8000, 0, 1, 730, 847] +[:left_analog_x_player_1, 9000, 0, 1, 731, 848] +[:left_analog_x_player_1, 10000, 0, 1, 732, 853] +[:left_analog_y_player_1, 3000, 0, 1, 733, 857] +[:left_analog_x_player_1, 11000, 0, 1, 734, 859] +[:left_analog_x_player_1, 12000, 0, 1, 735, 862] +[:left_analog_x_player_1, 13000, 0, 1, 736, 863] +[:left_analog_x_player_1, 14000, 0, 1, 737, 864] +[:left_analog_x_player_1, 15000, 0, 1, 738, 868] +[:left_analog_x_player_1, 14000, 0, 1, 739, 894] +[:left_analog_x_player_1, 13000, 0, 1, 740, 906] +[:left_analog_x_player_1, 12000, 0, 1, 741, 914] +[:left_analog_x_player_1, 11000, 0, 1, 742, 918] +[:left_analog_x_player_1, 10000, 0, 1, 743, 979] +[:left_analog_y_player_1, 2000, 0, 1, 744, 1036] +[:left_analog_y_player_1, 3000, 0, 1, 745, 1040] +[:left_analog_y_player_1, 2000, 0, 1, 746, 1041] +[:left_analog_y_player_1, 3000, 0, 1, 747, 1044] +[:left_analog_y_player_1, 2000, 0, 1, 748, 1045] +[:left_analog_y_player_1, 3000, 0, 1, 749, 1046] +[:left_analog_y_player_1, 2000, 0, 1, 750, 1047] +[:left_analog_y_player_1, 3000, 0, 1, 751, 1050] +[:left_analog_y_player_1, 2000, 0, 1, 752, 1052] +[:left_analog_y_player_1, 3000, 0, 1, 753, 1053] +[:left_analog_y_player_1, 2000, 0, 1, 754, 1054] +[:left_analog_x_player_1, 11000, 0, 1, 755, 1082] +[:left_analog_x_player_1, 14000, 0, 1, 756, 1083] +[:left_analog_x_player_1, 17000, 0, 1, 757, 1084] +[:left_analog_y_player_1, 3000, 0, 1, 758, 1084] +[:left_analog_x_player_1, 22000, 0, 1, 759, 1085] +[:left_analog_y_player_1, 4000, 0, 1, 760, 1085] +[:key_down_player_one, 4, 0, 1, 761, 1086] +[:left_analog_x_player_1, 26000, 0, 1, 762, 1086] +[:key_held_player_one, 4, 0, 1, 763, 1087] +[:left_analog_x_player_1, 29000, 0, 1, 764, 1087] +[:left_analog_y_player_1, 3000, 0, 1, 765, 1087] +[:key_held_player_one, 4, 0, 1, 766, 1088] +[:left_analog_x_player_1, 31000, 0, 1, 767, 1088] +[:right_analog_x_player_1, 1000, 0, 1, 768, 1088] +[:key_held_player_one, 4, 0, 1, 769, 1089] +[:left_analog_x_player_1, 32000, 0, 1, 770, 1089] +[:right_analog_x_player_1, 3000, 0, 1, 771, 1089] +[:key_held_player_one, 4, 0, 1, 772, 1090] +[:right_analog_x_player_1, 4000, 0, 1, 773, 1090] +[:key_held_player_one, 4, 0, 1, 774, 1091] +[:right_analog_x_player_1, 5000, 0, 1, 775, 1091] +[:key_held_player_one, 4, 0, 1, 776, 1092] +[:key_held_player_one, 4, 0, 1, 777, 1093] +[:right_analog_x_player_1, 6000, 0, 1, 778, 1093] +[:key_held_player_one, 4, 0, 1, 779, 1094] +[:key_held_player_one, 4, 0, 1, 780, 1095] +[:left_analog_y_player_1, 2000, 0, 1, 781, 1095] +[:right_analog_x_player_1, 4000, 0, 1, 782, 1095] +[:key_held_player_one, 4, 0, 1, 783, 1096] +[:left_analog_y_player_1, 3000, 0, 1, 784, 1096] +[:right_analog_x_player_1, 0, 0, 1, 785, 1096] +[:key_held_player_one, 4, 0, 1, 786, 1097] +[:key_held_player_one, 4, 0, 1, 787, 1098] +[:left_analog_y_player_1, 4000, 0, 1, 788, 1098] +[:key_held_player_one, 4, 0, 1, 789, 1099] +[:key_held_player_one, 4, 0, 1, 790, 1100] +[:key_held_player_one, 4, 0, 1, 791, 1101] +[:key_held_player_one, 4, 0, 1, 792, 1102] +[:key_held_player_one, 4, 0, 1, 793, 1103] +[:key_held_player_one, 4, 0, 1, 794, 1104] +[:key_held_player_one, 4, 0, 1, 795, 1105] +[:key_held_player_one, 4, 0, 1, 796, 1106] +[:key_held_player_one, 4, 0, 1, 797, 1107] +[:key_held_player_one, 4, 0, 1, 798, 1108] +[:key_held_player_one, 4, 0, 1, 799, 1109] +[:key_held_player_one, 4, 0, 1, 800, 1110] +[:key_held_player_one, 4, 0, 1, 801, 1111] +[:key_held_player_one, 4, 0, 1, 802, 1112] +[:key_held_player_one, 4, 0, 1, 803, 1113] +[:key_held_player_one, 4, 0, 1, 804, 1114] +[:key_held_player_one, 4, 0, 1, 805, 1115] +[:key_held_player_one, 4, 0, 1, 806, 1116] +[:key_held_player_one, 4, 0, 1, 807, 1117] +[:key_held_player_one, 4, 0, 1, 808, 1118] +[:key_held_player_one, 4, 0, 1, 809, 1119] +[:key_held_player_one, 4, 0, 1, 810, 1120] +[:key_held_player_one, 4, 0, 1, 811, 1121] +[:key_held_player_one, 4, 0, 1, 812, 1122] +[:key_held_player_one, 4, 0, 1, 813, 1123] +[:key_held_player_one, 4, 0, 1, 814, 1124] +[:key_held_player_one, 4, 0, 1, 815, 1125] +[:key_held_player_one, 4, 0, 1, 816, 1126] +[:key_held_player_one, 4, 0, 1, 817, 1127] +[:key_held_player_one, 4, 0, 1, 818, 1128] +[:key_held_player_one, 4, 0, 1, 819, 1129] +[:key_held_player_one, 4, 0, 1, 820, 1130] +[:key_held_player_one, 4, 0, 1, 821, 1131] +[:key_held_player_one, 4, 0, 1, 822, 1132] +[:key_held_player_one, 4, 0, 1, 823, 1133] +[:left_analog_y_player_1, 3000, 0, 1, 824, 1133] +[:key_held_player_one, 4, 0, 1, 825, 1134] +[:key_held_player_one, 4, 0, 1, 826, 1135] +[:key_held_player_one, 4, 0, 1, 827, 1136] +[:key_held_player_one, 4, 0, 1, 828, 1137] +[:key_held_player_one, 4, 0, 1, 829, 1138] +[:key_held_player_one, 4, 0, 1, 830, 1139] +[:key_held_player_one, 4, 0, 1, 831, 1140] +[:key_held_player_one, 4, 0, 1, 832, 1141] +[:key_held_player_one, 4, 0, 1, 833, 1142] +[:key_held_player_one, 4, 0, 1, 834, 1143] +[:key_held_player_one, 4, 0, 1, 835, 1144] +[:key_held_player_one, 4, 0, 1, 836, 1145] +[:key_held_player_one, 4, 0, 1, 837, 1146] +[:left_analog_y_player_1, 2000, 0, 1, 838, 1146] +[:key_held_player_one, 4, 0, 1, 839, 1147] +[:key_held_player_one, 4, 0, 1, 840, 1148] +[:key_held_player_one, 4, 0, 1, 841, 1149] +[:key_held_player_one, 4, 0, 1, 842, 1150] +[:key_held_player_one, 4, 0, 1, 843, 1151] +[:key_held_player_one, 4, 0, 1, 844, 1152] +[:key_held_player_one, 4, 0, 1, 845, 1153] +[:key_held_player_one, 4, 0, 1, 846, 1154] +[:key_held_player_one, 4, 0, 1, 847, 1155] +[:key_held_player_one, 4, 0, 1, 848, 1156] +[:key_held_player_one, 4, 0, 1, 849, 1157] +[:key_held_player_one, 4, 0, 1, 850, 1158] +[:key_held_player_one, 4, 0, 1, 851, 1159] +[:key_held_player_one, 4, 0, 1, 852, 1160] +[:key_held_player_one, 4, 0, 1, 853, 1161] +[:key_held_player_one, 4, 0, 1, 854, 1162] +[:key_held_player_one, 4, 0, 1, 855, 1163] +[:key_held_player_one, 4, 0, 1, 856, 1164] +[:key_held_player_one, 4, 0, 1, 857, 1165] +[:key_held_player_one, 4, 0, 1, 858, 1166] +[:key_held_player_one, 4, 0, 1, 859, 1167] +[:key_held_player_one, 4, 0, 1, 860, 1168] +[:key_held_player_one, 4, 0, 1, 861, 1169] +[:left_analog_y_player_1, 1000, 0, 1, 862, 1169] +[:key_held_player_one, 4, 0, 1, 863, 1170] +[:left_analog_y_player_1, 0, 0, 1, 864, 1170] +[:key_held_player_one, 4, 0, 1, 865, 1171] +[:key_held_player_one, 4, 0, 1, 866, 1172] +[:key_held_player_one, 4, 0, 1, 867, 1173] +[:key_held_player_one, 4, 0, 1, 868, 1174] +[:key_held_player_one, 4, 0, 1, 869, 1175] +[:key_held_player_one, 4, 0, 1, 870, 1176] +[:key_held_player_one, 4, 0, 1, 871, 1177] +[:left_analog_x_player_1, 28000, 0, 1, 872, 1177] +[:left_analog_y_player_1, 1000, 0, 1, 873, 1177] +[:key_held_player_one, 4, 0, 1, 874, 1178] +[:left_analog_x_player_1, 24000, 0, 1, 875, 1178] +[:left_analog_y_player_1, 2000, 0, 1, 876, 1178] +[:key_held_player_one, 4, 0, 1, 877, 1179] +[:left_analog_x_player_1, 17000, 0, 1, 878, 1179] +[:key_up_player_one, 4, 0, 1, 879, 1180] +[:left_analog_x_player_1, 5000, 0, 1, 880, 1180] +[:left_analog_y_player_1, 1000, 0, 1, 881, 1180] +[:left_analog_x_player_1, 0, 0, 1, 882, 1181] +[:left_analog_y_player_1, 0, 0, 1, 883, 1181] +[:key_down_raw, 1073742051, 1024, 2, 884, 1250] +[:key_down_raw, 113, 1024, 2, 885, 1250] +[:key_up_raw, 113, 1024, 2, 886, 1250] +[:key_up_raw, 1073742051, 0, 2, 887, 1250] diff --git a/samples/03_rendering_sprites/04_color_and_rotation/sprites/86.png b/samples/03_rendering_sprites/04_color_and_rotation/sprites/86.png Binary files differnew file mode 100644 index 0000000..dad681e --- /dev/null +++ b/samples/03_rendering_sprites/04_color_and_rotation/sprites/86.png |
