Parrot
The main character will be represented by this component, which will comprise of two different images (the same parrot with its wings up and down) driven by the Y
position property passed by <GameContainer />
:
/*** src/components/parrot.js ***/ import React from "react"; import { Image } from "react-native"; import { W, H } from "../constants"; export default class Parrot extends React.Component { constructor() { super(); this.state = { wings: "down" }; } componentWillUpdate(nextProps, nextState) { if (this.props.y < nextProps.y) { this.setState({ wings: "up" }); } else if (this.props.y > nextProps.y) { this.setState({ wings: "down" }); } } render() { let parrotImage; if (this.state.wings === "up") { parrotImage = require("../../images/parrot1.png"); } else { parrotImage = require("../../images/parrot2.png"); } return ( <Image source={parrotImage} style={{ position...