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 MotionSensor
Entity/Player/Player.h
- Committer:
- el17sm
- Date:
- 2019-04-23
- Revision:
- 12:a1c1991835ca
- Parent:
- 11:63e54f6e7939
- Child:
- 13:d04a6caba40d
File content as of revision 12:a1c1991835ca:
#ifndef PLAYER_H
#define PLAYER_H
#include "Entity.h"
class Player : public Entity {
public:
// Constructors
Player(float, float);
// Functions
virtual void move(float, float);
virtual int * get_frame();
virtual void chkdmg();
void buttons(bool, bool, bool, bool);
};
const float player_speed = 1.2;
const int sprite_player [4][4][12][6] = { // Player [Face][SpriteAnimationFrame][Size_Y][Size_X]
{ // Up
{
{0,1,1,1,1,0,},
{1,1,1,1,1,1,},
{1,1,1,1,1,1,},
{1,1,1,1,1,1,},
{0,1,1,1,1,0,},
{0,0,1,1,0,0,},
{0,1,1,1,1,0,},
{1,0,1,1,0,1,},
{1,0,1,1,0,1,},
{0,0,1,1,0,0,},
{0,1,0,0,1,0,},
{0,1,0,0,1,0,}
},
{
{0,1,1,1,1,0,},
{1,1,1,1,1,1,},
{1,1,1,1,1,1,},
{1,1,1,1,1,1,},
{0,1,1,1,1,0,},
{0,0,1,1,0,0,},
{0,1,1,1,1,0,},
{1,0,1,1,0,1,},
{0,0,1,1,0,1,},
{0,0,1,1,0,0,},
{0,1,0,0,1,0,},
{0,1,0,0,0,0,}
},
{
{0,1,1,1,1,0,},
{1,1,1,1,1,1,},
{1,1,1,1,1,1,},
{1,1,1,1,1,1,},
{0,1,1,1,1,0,},
{0,0,1,1,0,0,},
{0,1,1,1,1,0,},
{1,0,1,1,0,1,},
{1,0,1,1,0,1,},
{0,0,1,1,0,0,},
{0,1,0,0,1,0,},
{0,1,0,0,1,0,}
},
{
{0,1,1,1,1,0,},
{1,1,1,1,1,1,},
{1,1,1,1,1,1,},
{1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