About this deal
verifyErrors }}{{ message }}{{ /verifyErrors }}{{
First, create an array of obstacles which will hold all of the obstacle sprites. let obstacles: game.LedSprite[] = [] Before creating the code for the game actions, let’s first add some controls so that we can move around. We’ll control the bird by pressing the A button to go up or the B button to go down. let bird: game.LedSprite = null
Add your thoughts
Birds will usually be more comfortable with their wings held against their bodies, feet supported. Think about the size of the bird before you attempt to handle it: Vets aren't obliged to treat wildlife for free, and typically aren't trained in the care of wildlife, so it is a good idea to call around local practices before visiting, and find out if your vet has links with local wildlife rescue groups to make sure the animal is taken care of after being treated. if (obstacle3.get(LedSpriteProperty.X) == bird.get(LedSpriteProperty.X) && obstacle3.get(LedSpriteProperty.Y) == bird.get(LedSpriteProperty.Y)) {
Small birds: Can be firmly held in one hand, positioning the hand over the bird so that its head is between your fore and middle fingers, letting the rest of your fingers naturally wrap around the wings. Make obstacles disappear after reaching leftmost corner. Iterate over all obstacles, delete the obstacle sprites where the X coordinate equals 0, and remove them from the obstacles array. let obstacles: game.LedSprite[] = [] for element This is where things will start to get interesting. We’re going to randomly generate obstacles. We’ll keep all obstacles inside the array. All obstacles will have a single hole for the bird to fly through.Using loop ( iterate over the obstacles array) and decrease the obstacle X coordinate by 1. If it has feathers, it is a fledgling, and it is normal for them to spend a few days on the ground. Fledglings should be left alone unless they are in immediate danger and can be moved to a sheltered spot nearby e.g. under a hedge. It should fly away in a couple of days when its wings are fully developed!