team-copper / captAR

Augmented Reality Geolocation Capture-the-Flag Mobile Game Capstone Project
30 stars 3 forks source link

Lots of changes to Map.js #40

Closed jordanjpark closed 7 years ago

jordanjpark commented 7 years ago
  1. I made lots of comments on Map.js, so that others can understand work on the component too

  2. Store Player.js now has hardcoded initial state.

  3. I cleaned unnecessary codes on Map.js

  4. I removed player marker .png files and made a .js containing links to my dropbox (we can change this to firebase upload if speed becomes an issue). I spent more than 2 hours working on this issue.

Long story short, react-native doesn't support dynamic string path to image source. Read: https://github.com/facebook/react-native/issues/2481

So, in order to render each player marker by mapping through each player object, for example, source: {require: (../assets/${player.team}Player${index}.png) will not work.

Therefore, I formatted playerMarketPath as:

const playerMarkerPath = [ redPlayer1, bluePlayer1, redPlayer2, bluePlayer2, redPlayer3, bluePlayer3, redPlayer4, bluePlayer4 ];

This is a dumb way, but since we are going to set each player team alternatively, this could work..