Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to play Instructions and button Animation #88

Merged
merged 27 commits into from
May 28, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
05cfd7c
Keep changes when switching branch
faisal1201 May 22, 2022
c878404
Merge remote-tracking branch 'origin/master' into HOW_TO_PLAY_SCREEN
faisal1201 May 24, 2022
86a1bf1
Include How to play Button
faisal1201 May 24, 2022
392c7fb
Merge branch 'master' of https://github.com/DIT113-V22/group-08 into …
faisal1201 May 25, 2022
9b90be0
Add how to play Button on activity_main
faisal1201 May 25, 2022
c3d4f1a
Finish Getting Started screen
faisal1201 May 25, 2022
08458c7
Add instruction for controls and game modes
faisal1201 May 25, 2022
687362b
Add "How to play ?" instructions
faisal1201 May 26, 2022
cddaaea
Button Enhancement
faisal1201 May 26, 2022
e17bb1a
Fix some Layouts for PIXEL 3 XL API 31
faisal1201 May 27, 2022
635207a
Merge remote-tracking branch 'origin/master' into HOW_TO_PLAY_SCREEN
faisal1201 May 27, 2022
aac2b0f
Merge branch 'master' into HOW_TO_PLAY_SCREEN
faisal1201 May 27, 2022
9373dd6
just updating some methods name
May 27, 2022
6f7112a
Merge remote-tracking branch 'origin/HOW_TO_PLAY_SCREEN' into HOW_TO_…
faisal1201 May 27, 2022
87d70b5
Fix main Layout and add button enhancements to credits button
faisal1201 May 27, 2022
b011cec
Fixed the constraint for the main activity after the merge of credit …
May 27, 2022
fa5ab1d
Merge branch 'master' into HOW_TO_PLAY_SCREEN
Quinstedt May 27, 2022
5a89ebf
Fixed the Constraint
May 27, 2022
bfc4838
Game mode text view Title changed
faisal1201 May 27, 2022
8d844b5
Game mode text view Title changed
faisal1201 May 27, 2022
c185295
fixed the constraintof the scoreboard
May 27, 2022
e1fd59d
Merge remote-tracking branch 'origin/master' into HOW_TO_PLAY_SCREEN
May 28, 2022
88c07fa
Merge remote-tracking branch 'origin/master' into HOW_TO_PLAY_SCREEN
faisal1201 May 28, 2022
b1cbf88
Merge master to how to play screen
faisal1201 May 28, 2022
ee2642d
updated some comments, all test passing manually
May 28, 2022
738d3fb
Merge remote-tracking branch 'origin/HOW_TO_PLAY_SCREEN' into HOW_TO_…
May 28, 2022
57b1227
updated some comments, all test passing manually
May 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Android/islandRush/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.IslandRush">

<activity
android:name=".instructionClasses.CheckLeaderboard"
android:exported="false" />
<activity
android:name=".activityClasses.Scoreboard"
android:exported="false" />
Expand Down Expand Up @@ -42,6 +44,15 @@
<activity
android:name=".activityClasses.MainActivity"
android:exported="false" />
<activity
android:name=".instructionClasses.GettingStarted"
android:exported="false" />
<activity
android:name=".instructionClasses.GameModes"
android:exported="false" />
<activity
android:name=".instructionClasses.ControlsInstruction"
android:exported="false" />

<service android:name="org.eclipse.paho.android.service.MqttService" />
</application>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageButton;

Expand All @@ -15,6 +17,7 @@ public class ControlChoice extends AppCompatActivity {

Button controlPad, joystick;
ImageButton escapeHash;
Animation scaleUp,scaleDown;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -27,6 +30,9 @@ protected void onCreate(Bundle savedInstanceState) {
animationBackground.setExitFadeDuration(5000);
animationBackground.start();

scaleUp= AnimationUtils.loadAnimation(this, R.anim.scale_up);
scaleDown= AnimationUtils.loadAnimation(this, R.anim.scale_down);

escapeHash = findViewById(R.id.controlChoice_escapeHash);
escapeHash.setOnClickListener(view -> goBack());

Expand All @@ -43,6 +49,8 @@ protected void onCreate(Bundle savedInstanceState) {
*/
private void goBack() {
Intent goToMain = new Intent(this, MainActivity.class);
escapeHash.startAnimation(scaleUp);
escapeHash.startAnimation(scaleDown);
startActivity(goToMain);
}

Expand All @@ -51,13 +59,17 @@ private void goBack() {
*/
public void openButtonControl() {
Intent buttonControlIntent = new Intent(this, ControlPad.class);
controlPad.startAnimation(scaleUp);
controlPad.startAnimation(scaleDown);
startActivity(buttonControlIntent);
}
/**
* Launches Joystick Activity when joystick button is click
*/
public void openJoystick() {
Intent joystickIntent = new Intent(this, Joystick.class);
joystick.startAnimation(scaleUp);
joystick.startAnimation(scaleDown);
startActivity(joystickIntent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.quinstedt.islandRush.GlobalData;
import com.quinstedt.islandRush.R;
import com.quinstedt.islandRush.SplashScreens.LeaderboardAnimation;
import com.quinstedt.islandRush.Utils;
import com.quinstedt.islandRush.instructionClasses.GettingStarted;

public class MainActivity extends AppCompatActivity {
private EditText editText;
String playerNameInput;
Animation scaleUp,scaleDown;
Button enterRace,leaderboard,howToPlayBtn;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -33,9 +37,11 @@ protected void onCreate(Bundle savedInstanceState) {
animationBackground.setExitFadeDuration(5000);
animationBackground.start();

scaleUp= AnimationUtils.loadAnimation(this, R.anim.scale_up);
scaleDown= AnimationUtils.loadAnimation(this, R.anim.scale_down);

// On Click goes to Controller choice
Button enterRace = findViewById(R.id.button_enterRace);
enterRace = findViewById(R.id.button_enterRace);
enterRace.setOnClickListener(view -> openControlChoice());


Expand All @@ -61,13 +67,30 @@ protected void onCreate(Bundle savedInstanceState) {
*/


Button leaderboard = findViewById(R.id.button_Leaderboard);
leaderboard = findViewById(R.id.button_Leaderboard);
leaderboard.setOnClickListener(view -> openLeaderboard());

howToPlayBtn = findViewById(R.id.howToPlayBtn);
howToPlayBtn.setOnClickListener(view -> openTutorial());
}

/**
* Opens Instruction screen when the EnterRace button has been pressed
*/
private void openTutorial() {
Intent tutorialIntent = new Intent(this, GettingStarted.class);
howToPlayBtn.startAnimation(scaleUp);
howToPlayBtn.startAnimation(scaleDown);
startActivity(tutorialIntent);
}

/**
* Opens Scoreboard when the Leaderboard button has been pressed
*/
public void openLeaderboard() {
Intent leadIntent = new Intent(this, Scoreboard.class);
leaderboard.startAnimation(scaleUp);
leaderboard.startAnimation(scaleDown);
startActivity(leadIntent);
}

Expand All @@ -76,6 +99,8 @@ public void openLeaderboard() {
*/

public void openControlChoice() {
enterRace.startAnimation(scaleUp);
enterRace.startAnimation(scaleDown);
if(playerNameInput.isEmpty()){
String happyEmoji = Utils.getEmoji(Utils.HAPPY);
String toastMessage = "Enter a name " +happyEmoji;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.content.Intent;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageButton;

import androidx.appcompat.app.AppCompatActivity;
Expand All @@ -24,6 +26,7 @@ public class Scoreboard extends AppCompatActivity {
private RecyclerView RV;
private ViewModal viewmodal;
private ImageButton resetBtn,backToHome;
Animation scaleUp,scaleDown;



Expand All @@ -43,6 +46,10 @@ protected void onCreate(Bundle savedInstanceState) {
RV.setLayoutManager(new LinearLayoutManager(this));
RV.setHasFixedSize(true);

scaleUp= AnimationUtils.loadAnimation(this, R.anim.scale_up);
scaleDown= AnimationUtils.loadAnimation(this, R.anim.scale_down);


// initializing adapter for recycler view.
final PlayerScoreRVAdapter adapter = new PlayerScoreRVAdapter();

Expand All @@ -66,11 +73,14 @@ public void onChanged(List<PlayerScore> playerScores) {

private void goToHome() {
Intent goToMainIntent=new Intent(this, MainActivity.class);
backToHome.startAnimation(scaleUp);
backToHome.startAnimation(scaleDown);
startActivity(goToMainIntent);
}

private void deleteLeaderboard() {
resetBtn.startAnimation(scaleUp);
resetBtn.startAnimation(scaleDown);
viewmodal.deleteAllScores();

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.quinstedt.islandRush.instructionClasses;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.widget.ImageButton;

import com.quinstedt.islandRush.R;
import com.quinstedt.islandRush.activityClasses.MainActivity;

public class CheckLeaderboard extends AppCompatActivity {

ImageButton exitBtn4;
float x1,x2,y1,y2;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_check_leaderboard);

exitBtn4= findViewById(R.id.exitBtn4);
exitBtn4.setOnClickListener(view -> goBack());
}

private void goBack() {
Intent exitTutorial = new Intent(this, MainActivity.class);
startActivity(exitTutorial);
}

/**
* This method is used to swipe to the previous screen
*/
public boolean onTouchEvent(MotionEvent touchEvent2){
switch (touchEvent2.getAction()){
case MotionEvent.ACTION_DOWN:
x1 = touchEvent2.getX();
y1 = touchEvent2.getY();
break;
case MotionEvent.ACTION_UP:
x2 = touchEvent2.getX();
y2 = touchEvent2.getY();
if(x1 < x2){
Intent previousScreen = new Intent(this, ControlsInstruction.class);
startActivity(previousScreen);
}
}return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.quinstedt.islandRush.instructionClasses;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.widget.ImageButton;

import com.quinstedt.islandRush.R;
import com.quinstedt.islandRush.activityClasses.MainActivity;

public class ControlsInstruction extends AppCompatActivity {

ImageButton exitBtn3;
float x1,x2,y1,y2;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_controls_instruction);

exitBtn3= findViewById(R.id.exitBtn3);
exitBtn3.setOnClickListener(view -> goBack());
}

private void goBack() {
Intent exitTutorial = new Intent(this, MainActivity.class);
startActivity(exitTutorial);
}

/**
* This method is used to swipe to the previous or the next screen
*/
public boolean onTouchEvent(MotionEvent touchEvent2){
switch (touchEvent2.getAction()){
case MotionEvent.ACTION_DOWN:
x1 = touchEvent2.getX();
y1 = touchEvent2.getY();
break;
case MotionEvent.ACTION_UP:
x2 = touchEvent2.getX();
y2 = touchEvent2.getY();
if(x1 < x2){
Intent previousScreen = new Intent(this,GameModes.class);
startActivity(previousScreen);
}else if(x1>x2){
Intent nextScreen = new Intent(this, CheckLeaderboard.class);
startActivity(nextScreen);}

}return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.quinstedt.islandRush.instructionClasses;

import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.widget.ImageButton;

import androidx.appcompat.app.AppCompatActivity;

import com.quinstedt.islandRush.R;
import com.quinstedt.islandRush.activityClasses.MainActivity;

public class GameModes extends AppCompatActivity {

ImageButton exitBtn2;
float x1,x2,y1,y2;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_game_modes);
exitBtn2= findViewById(R.id.exitBtn2);
exitBtn2.setOnClickListener(view -> goBack());

}

/**
* This method is used to swipe to the previous screen or the next screen
*/
public boolean onTouchEvent(MotionEvent touchEvent2){
switch (touchEvent2.getAction()){
case MotionEvent.ACTION_DOWN:
x1 = touchEvent2.getX();
y1 = touchEvent2.getY();
break;
case MotionEvent.ACTION_UP:
x2 = touchEvent2.getX();
y2 = touchEvent2.getY();
if(x1 < x2){
Intent previousScreen = new Intent(this, GettingStarted.class);
startActivity(previousScreen);
}else if(x1>x2){
Intent nextScreen = new Intent(this, ControlsInstruction.class);
startActivity(nextScreen);}
}return false;
}

private void goBack() {
Intent exitTutorial = new Intent(this, MainActivity.class);
startActivity(exitTutorial);
}

}
Loading