Skip to content

Commit 6c46813

Browse files
author
sarthakpranesh
committed
Fixed orientation and minor fixes
1 parent 2aee9fe commit 6c46813

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
android:name=".MainActivity"
1515
android:label="@string/app_name"
1616
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
17+
android:screenOrientation="portrait"
1718
android:windowSoftInputMode="adjustResize">
1819
<intent-filter>
1920
<action android:name="android.intent.action.MAIN" />

src/components/Physics.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const GameControl = (entities, {touches, dispatch}) => {
7272
if (body.position[0] <= -Constants.PIPE_WIDTH) {
7373
scored = false;
7474
body.position[2] = randomBetween();
75-
body.position[0] = Constants.MAX_WIDTH * 2 + Constants.PIPE_WIDTH / 2;
75+
body.position[0] = Constants.MAX_WIDTH * 2 - Constants.PIPE_WIDTH;
7676
}
7777
body.position[0] -= 1;
7878
return;
@@ -88,11 +88,11 @@ export const GameControl = (entities, {touches, dispatch}) => {
8888

8989
touches.forEach(t => {
9090
if (gravity === 0) {
91-
gravity = 6;
91+
gravity = 5.4;
9292
}
9393

9494
if (!(entities['1'].position[1] < 40)) {
95-
birdJump = 16;
95+
birdJump = gravity * 2;
9696
}
9797
});
9898

src/screens/GameHome.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export default class GameHome extends Component {
4444
}
4545

4646
componentDidMount() {
47-
SoundPlayer.playSoundFile('point', 'wav');
4847
Animated.timing(this.onLoad, {
4948
duration: 1000,
5049
toValue: new Animated.Value(1),
@@ -53,20 +52,19 @@ export default class GameHome extends Component {
5352
}).start();
5453

5554
this.props.navigation.addListener('focus', () => {
56-
if (this.translateBirdX !== 0) {
57-
Animated.timing(this.onPlay, {
58-
duration: 500,
59-
toValue: 0,
55+
SoundPlayer.playSoundFile('point', 'wav');
56+
Animated.timing(this.onPlay, {
57+
duration: 500,
58+
toValue: 0,
59+
useNativeDriver: true,
60+
}).start(() => {
61+
Animated.timing(this.onLoad, {
62+
duration: 1000,
63+
toValue: new Animated.Value(1),
6064
useNativeDriver: true,
61-
}).start(() => {
62-
Animated.timing(this.onLoad, {
63-
duration: 1000,
64-
toValue: new Animated.Value(1),
65-
useNativeDriver: true,
66-
easing: Easing.bounce,
67-
}).start();
68-
});
69-
}
65+
easing: Easing.bounce,
66+
}).start();
67+
});
7068
});
7169
}
7270

src/screens/Play.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ export default class Play extends PureComponent {
3434
};
3535
}
3636

37+
componentDidMount() {
38+
SoundPlayer.loadSoundFile('point', 'wav');
39+
SoundPlayer.loadSoundFile('hit', 'wav');
40+
}
41+
3742
updateUserScore = score => {
3843
const {uid} = this.state;
3944
firestore()

0 commit comments

Comments
 (0)