diff options
| author | _Tradam <[email protected]> | 2021-12-16 19:22:26 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-16 19:22:26 -0500 |
| commit | 5954b9beb4d4a3b4f248d72d1851195f030558a8 (patch) | |
| tree | fecd8aa840a25afdb502915b0fdb4d03b7ed339a /deploy_template/mygame/documentation/08-controllers.md | |
| parent | 2f845281f133849256b57bb08fd3e9ae57600784 (diff) | |
| parent | eaa29e72939f5edf61735ccbb73c36ee89369f65 (diff) | |
| download | dragonruby-game-toolkit-contrib-5954b9beb4d4a3b4f248d72d1851195f030558a8.tar.gz dragonruby-game-toolkit-contrib-5954b9beb4d4a3b4f248d72d1851195f030558a8.zip | |
Diffstat (limited to 'deploy_template/mygame/documentation/08-controllers.md')
| -rw-r--r-- | deploy_template/mygame/documentation/08-controllers.md | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/deploy_template/mygame/documentation/08-controllers.md b/deploy_template/mygame/documentation/08-controllers.md deleted file mode 100644 index fca575f..0000000 --- a/deploy_template/mygame/documentation/08-controllers.md +++ /dev/null @@ -1,86 +0,0 @@ -# Controllers - -There are two controllers you have access to: - -``` -args.inputs.controller_one -args.inputs.controller_two -``` - -Determining if a key was down: - -``` -if args.inputs.controller_one.key_down.a - puts 'The key was in the down state' -end -``` - -Determining if a key is being held: - -``` -if args.inputs.controller_one.key_held.a - puts 'The key is being held' -end -``` - -Determining if a key is released: - -``` -if args.inputs.controller_one.key_up.a - puts 'The key is being held' -end -``` - -# Truthy Keys - -You can access all triggered keys through `truthy_keys` on `keyboard`, `controller_one`, and `controller_two`. - -This is how you would right all keys to a file. The game must be in the foreground and have focus for this data -to be recorded. - -``` -def tick args - [ - [args.inputs.keyboard, :keyboard], - [args.inputs.controller_one, :controller_one], - [args.inputs.controller_two, :controller_two] - ].each do |input, name| - if input.key_down.truthy_keys.length > 0 - args.gtk.write_file("mygame/app/#{name}_key_down_#{args.state.tick_count}", input.key_down.truthy_keys.to_s) - end - end -end -``` - -# List of keys: - -``` -args.inputs.controller_one.key_held.up -args.inputs.controller_one.key_held.down -args.inputs.controller_one.key_held.left -args.inputs.controller_one.key_held.right -args.inputs.controller_one.key_held.a -args.inputs.controller_one.key_held.b -args.inputs.controller_one.x -args.inputs.controller_one.y -args.inputs.controller_one.key_held.l1 -args.inputs.controller_one.key_held.r1 -args.inputs.controller_one.key_held.l2 -args.inputs.controller_one.key_held.r2 -args.inputs.controller_one.key_held.l3 -args.inputs.controller_one.key_held.r3 -args.inputs.controller_one.key_held.start -args.inputs.controller_one.key_held.select -args.inputs.controller_one.key_held.directional_up -args.inputs.controller_one.key_held.directional_down -args.inputs.controller_one.key_held.directional_left -args.inputs.controller_one.key_held.directional_right -args.inputs.controller_one.left_analog_x_raw, -args.inputs.controller_one.left_analog_y_raw, -args.inputs.controller_one.left_analog_x_perc, -args.inputs.controller_one.left_analog_y_perc, -args.inputs.controller_one.right_analog_x_raw, -args.inputs.controller_one.right_analog_y_raw, -args.inputs.controller_one.right_analog_x_perc, -args.inputs.controller_one.right_analog_y_perc -``` |
