GameOver
When the parrot collides with a rock or the ground, we should display the game over screen. This screen only contains two images:
- A game over sign
- A button to restart the game
Let's first take a look at the game over sign:
/*** src/components/GameOver.js ***/ import React, { Component } from "react"; import { Image } from "react-native"; import { W, H } from "../constants"; export default class GameOver extends Component { render() { return ( <Image style={{ position: "absolute", left: 15 * W, top: 30 * H }} resizeMode="stretch" source={require("../../images/game-over.png")} /> ); } }
Now, let's move on to the reset the game button.