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
ROCK/Rock.cpp@4:e46c295d4baf, 2020-05-23 (annotated)
- Committer:
- ChenZirui
- Date:
- Sat May 23 18:12:03 2020 +0000
- Revision:
- 4:e46c295d4baf
update
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ChenZirui | 4:e46c295d4baf | 1 | #include"ROCK.h" |
| ChenZirui | 4:e46c295d4baf | 2 | rock::rock() |
| ChenZirui | 4:e46c295d4baf | 3 | { |
| ChenZirui | 4:e46c295d4baf | 4 | |
| ChenZirui | 4:e46c295d4baf | 5 | } |
| ChenZirui | 4:e46c295d4baf | 6 | |
| ChenZirui | 4:e46c295d4baf | 7 | rock::~rock() |
| ChenZirui | 4:e46c295d4baf | 8 | { |
| ChenZirui | 4:e46c295d4baf | 9 | |
| ChenZirui | 4:e46c295d4baf | 10 | } |
| ChenZirui | 4:e46c295d4baf | 11 | |
| ChenZirui | 4:e46c295d4baf | 12 | void rock::init(int size,int speed) |
| ChenZirui | 4:e46c295d4baf | 13 | { |
| ChenZirui | 4:e46c295d4baf | 14 | srand(time(null)); |
| ChenZirui | 4:e46c295d4baf | 15 | int a=rand()%84; |
| ChenZirui | 4:e46c295d4baf | 16 | int i; |
| ChenZirui | 4:e46c295d4baf | 17 | for(i=0;i<85;i++) |
| ChenZirui | 4:e46c295d4baf | 18 | { |
| ChenZirui | 4:e46c295d4baf | 19 | if(i==a) |
| ChenZirui | 4:e46c295d4baf | 20 | { |
| ChenZirui | 4:e46c295d4baf | 21 | _velocity.x=_a |
| ChenZirui | 4:e46c295d4baf | 22 | _velocity.y=speed |
| ChenZirui | 4:e46c295d4baf | 23 | } |
| ChenZirui | 4:e46c295d4baf | 24 | } |
| ChenZirui | 4:e46c295d4baf | 25 | |
| ChenZirui | 4:e46c295d4baf | 26 | } |