Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: Skateboarder/Stakeboarder.cpp
- Revision:
- 3:28a3c118e071
- Parent:
- 2:16ae940b0aee
- Child:
- 4:ce4eea1c2a28
--- a/Skateboarder/Stakeboarder.cpp Wed Mar 13 15:10:36 2019 +0000 +++ b/Skateboarder/Stakeboarder.cpp Sat Mar 16 10:38:04 2019 +0000 @@ -1,5 +1,97 @@ #include "Skateboarder.h" + int skate_right[17][12] = { + + { 0,0,0,0,1,1,1,0,0,0,0,0 }, + { 0,0,0,0,1,1,1,1,0,0,0,0 }, + { 0,0,1,1,1,1,1,1,0,0,0,0 }, + { 0,0,0,0,1,0,1,1,0,0,0,0 }, + { 0,0,0,0,1,1,1,0,0,0,0,0 }, + { 0,0,0,0,1,1,0,0,0,0,0,0 }, + { 0,0,0,0,1,1,0,0,0,0,0,0 }, + { 0,0,1,1,1,1,1,1,1,0,0,0 }, + { 0,1,1,0,1,1,0,0,1,1,0,0 }, + { 0,1,0,0,1,1,0,0,0,0,0,0 }, + { 0,0,0,0,1,1,0,0,0,0,0,0 }, + { 0,0,0,0,1,1,0,0,0,0,0,0 }, + { 0,0,0,0,1,0,1,0,0,0,0,0 }, + { 0,0,0,0,1,0,0,1,0,0,0,0 }, + { 0,1,0,0,1,0,0,0,1,0,1,0 }, + { 0,0,1,1,1,1,1,1,1,1,0,0 }, + { 0,0,0,1,0,0,0,0,1,0,0,0 }, + + +}; + +int skate_left[17][12] = { + + { 0,0,0,0,1,1,1,0,0,0,0,0 }, + { 0,0,0,1,1,1,1,0,0,0,0,0 }, + { 0,0,0,1,1,1,1,1,1,0,0,0 }, + { 0,0,0,1,1,0,1,0,0,0,0,0 }, + { 0,0,0,0,1,1,1,0,0,0,0,0 }, + { 0,0,0,0,0,1,1,0,0,0,0,0 }, + { 0,0,0,0,0,1,1,1,0,0,0,0 }, + { 0,1,1,1,1,1,1,1,0,0,0,0 }, + { 0,0,0,1,1,1,1,1,1,0,0,0 }, + { 0,0,0,0,1,1,0,0,1,0,0,0 }, + { 0,0,0,0,1,1,0,0,0,1,0,0 }, + { 0,0,0,0,1,1,0,0,0,0,0,0 }, + { 0,0,0,1,0,1,0,0,0,0,0,0 }, + { 0,0,1,0,0,1,0,0,0,0,0,0 }, + { 1,1,0,0,0,1,0,0,0,1,0,0 }, + { 0,1,1,1,1,1,1,1,1,0,0,0 }, + { 0,0,0,1,0,0,0,0,1,0,0,0 }, + + +}; + +int skate_standing_left[17][12] = { + + { 0,0,0,0,1,1,0,0,0,0,0,0 }, + { 0,0,0,1,1,1,1,0,0,0,0,0 }, + { 0,0,0,1,1,1,1,1,1,0,0,0 }, + { 0,0,0,1,0,0,1,0,0,0,0,0 }, + { 0,0,0,1,1,1,1,0,0,0,0,0 }, + { 0,0,0,0,1,1,0,0,0,0,0,0 }, + { 0,0,0,1,1,1,1,0,0,0,0,0 }, + { 0,0,1,1,1,1,0,1,0,0,0,0 }, + { 1,1,0,1,1,1,0,1,0,0,0,0 }, + { 0,0,0,1,1,1,0,0,0,0,0,0 }, + { 0,0,1,1,1,1,0,0,0,0,0,0 }, + { 1,0,1,0,0,1,0,0,0,0,0,0 }, + { 1,1,0,0,0,1,0,0,0,0,0,0 }, + { 0,1,0,0,0,1,0,0,0,0,0,0 }, + { 1,0,1,0,0,1,0,0,0,0,0,0 }, + { 0,0,0,1,0,1,0,0,0,0,0,0 }, + { 0,0,1,0,1,1,1,0,0,0,0,0 }, + + +}; + +int skate_standing_right[17][12] = { + + { 0,0,0,0,1,1,0,0,0,0,0,0 }, + { 0,0,0,1,1,1,1,0,0,0,0,0 }, + { 0,1,1,1,1,1,1,0,0,0,0,0 }, + { 0,0,0,1,0,0,1,0,0,0,0,0 }, + { 0,0,0,1,1,1,1,0,0,0,0,0 }, + { 0,0,0,0,1,1,0,0,0,0,0,0 }, + { 0,0,0,1,1,1,1,0,0,0,0,0 }, + { 0,0,1,1,1,1,0,1,0,0,0,0 }, + { 0,1,0,1,1,1,0,0,1,0,0,0 }, + { 0,1,0,1,1,1,0,0,0,0,0,0 }, + { 0,0,0,1,1,1,1,1,0,0,0,0 }, + { 0,0,0,1,0,0,0,1,0,1,0,0 }, + { 0,0,0,1,0,0,0,1,1,0,0,0 }, + { 0,0,0,1,0,0,0,1,0,1,0,0 }, + { 0,0,0,1,0,0,1,0,0,0,0,0 }, + { 0,0,0,1,0,1,0,0,0,0,0,0 }, + { 0,0,1,1,1,0,1,0,0,0,0,0 }, + + +}; + Skateboarder::Skateboarder(){} Skateboarder::~Skateboarder(){} @@ -26,17 +118,26 @@ } -void Skateboarder::set_y_position(bool jump, int jump_counter) { +void Skateboarder::set_y_position(bool jump, int jump_counter, int level) { _jump_counter = jump_counter; - + _level = level; if(jump) { _jump_counter = 40; } if(_jump_counter !=0){ _jump_counter--; } - _y = 23 - 0.5*_jump_counter; + + + + if(_level == 0){ + _y = 23 - 0.5*_jump_counter; + } + + else { + _y = 5 - 0.25*_jump_counter; // need to get rid of double jump use if(jump) + } } @@ -57,8 +158,23 @@ int Skateboarder::get_jump_counter(){ return _jump_counter; } + +Skate_Direction Skateboarder::get_direction(){ + return _skate_direction; + } -Sprite_value Skateboarder::get_sprite(){ +Sprite_value Skateboarder::get_sprite_value(){ return _sprite_value; } - \ No newline at end of file + +int * Skateboarder::get_sprite(Sprite_value sprite){ + if(sprite == Skate_right){ + return *skate_right; + } else if(sprite == Skate_left){ + return *skate_left; + } else if(sprite == Stand_left){ + return *skate_standing_left; + } else { + return *skate_standing_right; + } +} \ No newline at end of file