![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
All there but errors need fixing
Tetromino/Tetromino.cpp
- Committer:
- el18rs
- Date:
- 2020-05-31
- Revision:
- 5:53e021832adc
- Parent:
- 4:7ddd287a5d28
File content as of revision 5:53e021832adc:
#include "Tetromino.h" int tetromino[3][4][4] = { { {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1} }, { {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1} }, { {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1} } }; Tetromino::Tetromino() { } Tetromino::~Tetromino() { } void Tetromino::init(int number, int x, int y, int speed) { _x = x; _y = y; _speed = speed; _number = blockArray[blocknumber]; _speed = 1; _x = WIDTH/2 - 2; _y = HEIGHT; _velocity.x = speed; _velocity.y = speed; } void Tetromino::update(Direction d, float mag) { _speed = int(mag*10.0f); if (d == CENTRE) { _y+=_speed; } else if (d == S) { _y+=_speed*2; } else if (d == E) { _x+=_speed; } else if (d == W) { _x-=_speed; } if (_x < 1) { _x = 1; } if (_x > WIDTH - 3) { _x = WIDTH - 3; } } Vector2D Tetromino::get_pos() { Vector2D p = {_x,_y}; return p; }