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.
Diff: Friendly.cpp
- Revision:
- 10:b856d73db923
- Parent:
- 9:3c411d37d390
- Child:
- 11:4c4a0fe18ac2
--- a/Friendly.cpp Mon May 01 13:01:20 2017 +0000 +++ b/Friendly.cpp Tue May 02 22:12:52 2017 +0000 @@ -29,8 +29,6 @@ void Friendly::update(Direction d,float mag) { _speed = int(mag*4.0f); - - // eight-directional movement if (d == N) { _y-=_speed; } else if (d == S) { @@ -52,8 +50,9 @@ _y+=_speed; _x+=_speed; } +} - // position check so the ship doesn't go out of bounds +void Friendly::check_pos() { if (_y < 1) { _y = 1; } @@ -71,6 +70,7 @@ } } + Vector2D Friendly::get_pos() { Vector2D p = {_x,_y}; return p;