Flappy Pig – Obstacle Gapping, Coin Pickup, and Coin Spawning
Day 084 #100DaysOfCode
Day 048 #100DaysOfGameDev
Obstacle Gaps
- added variable in PostPool to determine the gap between last post and current post
- if gap exceeds the minimum required, spawns in a new post
![](https://i0.wp.com/gamedev.sinwyrm.com/wp-content/uploads/2020/02/2020-02-25notepad_script_PostPool_postGap.png?resize=800%2C273&ssl=1)
![](https://i0.wp.com/gamedev.sinwyrm.com/wp-content/uploads/2020/02/2020-02-25notepad_script_PostPool_check-new-post.png?resize=800%2C505&ssl=1)
Coin Pickup
- created a new script to determine if a collision with a coin is made
- upon collision, the score is updated and the coin is destroyed
![](https://i0.wp.com/gamedev.sinwyrm.com/wp-content/uploads/2020/02/2020-02-25notepad_script_CoinPickup.png?resize=800%2C233&ssl=1)
Coin Spawn
- created a new script to handle the spawning of new coins
- set minimum time between spawns
- use random X and Y parameters (within a range) as the spawn point
![](https://i0.wp.com/gamedev.sinwyrm.com/wp-content/uploads/2020/02/2020-02-25notepad_script_CoinSpawn.png?resize=800%2C431&ssl=1)