This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:cprog:spring2025:projects:mtb4 [2025/03/12 20:23] – [power ups] tstrickl | notes:cprog:spring2025:projects:mtb4 [2025/03/13 03:45] (current) – [power ups] bdildine | ||
---|---|---|---|
Line 40: | Line 40: | ||
}; | }; | ||
- | instead of literally typing 1, you could just write MATT, and it would automatically be replaced by the value 1. | + | instead of literally typing 1, you could just write MATT, and it would represent |
- | Back to the context of powerups you could make an enum as such: | + | Back to the context of powerups, you could make an enum as such: |
enum POWERUPS | enum POWERUPS | ||
{ | { | ||
- | Duplicate | + | DUPLICATE |
- | MoarDamage | + | MOARDAMAGE |
- | Faster | + | FASTER |
}; | }; | ||
Line 56: | Line 56: | ||
{ | { | ||
Point position; | Point position; | ||
- | int type; | + | POWERUPS |
} | } | ||
- | then define | + | then create |
+ | < | ||
void main() | void main() | ||
{ | { | ||
- | | + | |
- | | + | |
| | ||
- | | + | |
} | } | ||
+ | </ | ||
+ | now everytime that you call ptrPowerup-> | ||
- | after providing values, now everytime that you call ptrPowerup->type it will return 1, because DUPLICATE | + | Some Power-Ups |
- | ====logic | + | You can accomplish this by checking if the Power-Up |
+ | You will of course need to change the boundaries in which the ball collides with the bigger paddle | ||
+ | If you are using an array to track your Power-Ups, it would look something like: | ||
+ | < | ||
+ | if ( PowerUpCollected[1] | ||
+ | { | ||
+ | select_region( RegionLargePaddle ); | ||
+ | } else { | ||
+ | select_region( RegionPaddle ); | ||
+ | } | ||
+ | draw_region_at( PaddleX, PaddleY ); | ||
+ | </ |