chore: update to work on latest Android Studio and Android 14.

This commit is contained in:
John Espiritu 2024-02-04 01:17:28 -08:00
parent 8ce1c8b82e
commit 5481f2710d
52 changed files with 483 additions and 205 deletions

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hkri.HoppyGirl"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="15"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<activity android:name="Hoppy_Girl"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
</application>
</manifest>

View File

@ -4,8 +4,8 @@ Hoppy Girl is a infinite running game for Android.
## Status
The project was developed for the old platforms. For this reason, it is archived for historical purposes and is no longer being maintained or updated.
The project was originally developed for the old Android platform. Updated recently to compile with the latest version Android Studio and Android 14. Tested running on Android 14 and Google Pixel 5. Still uses the AndEngine dependency and doesn't fully use the screen on modern phones.
## Author
* John Espiritu
* John Espiritu

View File

@ -1,17 +0,0 @@
# This file is used to override default values used by the Ant build system.
#
# This file must be checked into Version Control Systems, as it is
# integral to the build system of your project.
# This file is only used by the Ant script.
# You can use this to override default values such as
# 'source.dir' for the location of your java source folder and
# 'out.dir' for the location of your output folder.
# You can also use it define how the release builds are signed by declaring
# the following properties:
# 'key.store' for the location of your keystore and
# 'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.

38
app/build.gradle Normal file
View File

@ -0,0 +1,38 @@
plugins {
id ("com.android.application")
}
android {
namespace = "com.hkri.hoppygirl"
compileSdk = 34
defaultConfig {
applicationId = "com.hkri.hoppygirl"
minSdk = 26
targetSdk = 34
versionCode = 15
versionName = "1.0.0"
}
buildTypes {
release {
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding = true
}
}
dependencies {
implementation 'eu.codlab:andengine:1.7.6'
}

21
app/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<activity android:name=".HoppyGirl" android:exported="true" android:theme="@style/AppFullScreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -1,4 +1,4 @@
package com.hkri.HoppyGirl;
package com.hkri.hoppygirl;
import org.andengine.engine.Engine;
import org.andengine.entity.scene.Scene;

View File

@ -1,4 +1,4 @@
package com.hkri.HoppyGirl;
package com.hkri.hoppygirl;
import org.andengine.engine.Engine;
import org.andengine.entity.primitive.Rectangle;

View File

@ -1,4 +1,4 @@
package com.hkri.HoppyGirl;
package com.hkri.hoppygirl;
import org.andengine.engine.Engine;
import org.andengine.entity.scene.Scene;

View File

@ -1,4 +1,4 @@
package com.hkri.HoppyGirl;
package com.hkri.hoppygirl;
import org.andengine.audio.sound.Sound;
import org.andengine.audio.sound.SoundFactory;
@ -28,13 +28,13 @@ import org.andengine.opengl.texture.region.ITiledTextureRegion;
import org.andengine.ui.activity.SimpleBaseGameActivity;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.andengine.util.color.Color;
import org.andengine.util.debug.Debug;
import java.util.ArrayList;
/**
* (c) 2014 John Espiritu
* (c) 2014 hkri studios
*
* @author John Espiritu
* @since December 26, 2014
@ -43,11 +43,9 @@ import java.util.ArrayList;
public class GameScreen extends Scene implements IOnSceneTouchListener {
//Sounds!
Sound selectSound;
Sound dieSound;
//Scoring sprites
BitmapTextureAtlas scoreDigitAtlas;
ITextureRegion mScoreLabelMain;
BuildableBitmapTextureAtlas scoreDigitsAtlas;
@ -57,11 +55,9 @@ public class GameScreen extends Scene implements IOnSceneTouchListener {
ArrayList<TiledSprite> scoreDigitsScoreboard = new ArrayList<TiledSprite>();
ArrayList<TiledSprite> scoreDigitsScoreboardBest = new ArrayList<TiledSprite>();
//Button elements
ITextureRegion mReplayButtonRegion;
ITextureRegion mLeaderboardButtonRegion;
//Scoreboard elements
ITextureRegion mGameoverRegion;
Sprite mGameoverSprite;
Sprite mLeaderboardButtonSprite;
@ -69,76 +65,62 @@ public class GameScreen extends Scene implements IOnSceneTouchListener {
ITextureRegion mCrownRegion;
Sprite mCrownSprite;
//Crash cover
Rectangle crashCover;
//Game atlas.
BitmapTextureAtlas bmpAtlas;
BitmapTextureAtlas crystalAtlas;
//Crystal regions
ITextureRegion mCrystal1Region, mCrystal2Region, mCrystal3Region;
//Cover sprite
ITextureRegion mCoverRegion;
Sprite mCoverSprite;
//Guide variable
ITextureRegion mGetReadyRegion;
Sprite mGetReadySprite;
//Floor variables
ITextureRegion mFloorRegion;
float FLOOR_Y = 0.0f;
float FLOOR_VELOCITY = 5f;
//Cloud variables
ITextureRegion mCloudRegion;
float CLOUD_VELOCITY = 1f;
float CLOUD_Y = 40f;
//Collections
ArrayList<Floor> lstFloors = new ArrayList<Floor>();
ArrayList<CloudsBG> lstClouds = new ArrayList<CloudsBG>();
//Obstacle collections
ArrayList<CrystalObstacles> lstCrystalO = new ArrayList<CrystalObstacles>();
//Activity properties
TextureManager mTManager;
SimpleBaseGameActivity mActivity;
Engine mEngine;
Camera mCamera;
boolean gameoverShown = false;
//Player variable
Player mPlayer;
int gameScore = 0;
boolean scoreMainVisible = false;
float mTime = 0;
//Obstacle variable
float[] crystalObstacleIntervals = { 36f, 45f, 75f, 10f, 55f, 50f, 25f};
float crystalObstacleCurrentInterval = 50f;
float crystalObstacleCtr = 0;
int consecutiveClose = 0;
//Scorer obstacle jumped
Rectangle scoreChecker;
public GameScreen(final SimpleBaseGameActivity actvt, TextureManager tmgr, Engine engn, Camera cm){
//Setup activity properties
public GameScreen(final SimpleBaseGameActivity actvt, TextureManager tmgr, Engine engn, Camera cm) {
mTManager = tmgr;
mActivity = actvt;
mEngine = engn;
mCamera = cm;
loadResources(); //Load resources to memory.
loadResources();
setOnSceneTouchListener(this); //Set screen touch listener
setOnSceneTouchListener(this);
setTouchAreaBindingOnActionDownEnabled(true);
//Setup score text main
mScoreLabelMainSprite = new Sprite(mCamera.getWidth() - mScoreLabelMain.getWidth() - 15f, 15f, mScoreLabelMain, mEngine.getVertexBufferObjectManager());
mScoreLabelMainSprite.setZIndex(5);
mScoreLabelMainSprite.setAlpha(0f);
@ -147,25 +129,21 @@ public class GameScreen extends Scene implements IOnSceneTouchListener {
//FLOOR_Y = (mPlayer.getPlayerSprite().getY() + mPlayer.getPlayerSprite().getHeight());
FLOOR_Y = (mCamera.getHeight() - 60f);
//Setup scene background
setBackground(new Background(Hoppy_Girl.getClr(237), Hoppy_Girl.getClr(237), Hoppy_Girl.getClr(237)));
setBackground(new Background(HoppyGirl.getClr(237), HoppyGirl.getClr(237), HoppyGirl.getClr(237)));
//Add fader (fade in)
mCoverSprite = new Sprite(0, 0, mCoverRegion, mEngine.getVertexBufferObjectManager());
mCoverSprite.registerEntityModifier(new AlphaModifier(0.3f, 1.0f, 0.0f));
mCoverSprite.setSize(cm.getWidth(), cm.getHeight());
mCoverSprite.setZIndex(100);
attachChild(mCoverSprite);
//scoreboard labels setup
mGameoverSprite = new Sprite((mCamera.getWidth() - mGameoverRegion.getWidth()) * 0.5f - 30f, 105f, mGameoverRegion, mEngine.getVertexBufferObjectManager());
mGameoverSprite.setZIndex(110);
mGameoverSprite.setAlpha(0.0f);
attachChild(mGameoverSprite);
//Crash white cover
crashCover = new Rectangle(0, 0, mCamera.getWidth(), mCamera.getHeight(), mEngine.getVertexBufferObjectManager());
crashCover.setColor(Hoppy_Girl.getClr(237),Hoppy_Girl.getClr(237),Hoppy_Girl.getClr(237));
crashCover.setColor(HoppyGirl.getClr(237),HoppyGirl.getClr(237),HoppyGirl.getClr(237));
crashCover.setAlpha(0f);
crashCover.setZIndex(99);
attachChild(crashCover);
@ -174,18 +152,15 @@ public class GameScreen extends Scene implements IOnSceneTouchListener {
while(getLastFloorRight() < mCamera.getWidth() + 50f) addFloor();
//Add player
mPlayer = new Player(mActivity, mTManager, mEngine);
mPlayer.getPlayerSprite().setPosition(50f, FLOOR_Y - mPlayer.getPlayerSprite().getHeight());
mPlayer.setFloorLimit(FLOOR_Y - mPlayer.getPlayerSprite().getHeight());
mPlayer.attachPlayerSprite(this);
//SCORE CHECKER SETUP
scoreChecker = new Rectangle(mPlayer.getPlayerSprite().getX(), FLOOR_Y - 30f, 10f, 30f, mEngine.getVertexBufferObjectManager());
scoreChecker.setColor(org.andengine.util.color.Color.TRANSPARENT);
scoreChecker.setColor(Color.TRANSPARENT);
attachChild(scoreChecker);
//Add scoreboard buttons
mReplayButtonSprite = new Sprite((mCamera.getWidth() - mReplayButtonRegion.getWidth()) * 0.5f - (mReplayButtonRegion.getWidth() * 0.5f + 15f), 265f, mReplayButtonRegion, mEngine.getVertexBufferObjectManager()) {
boolean isPressed = false;
@Override
@ -193,7 +168,7 @@ public class GameScreen extends Scene implements IOnSceneTouchListener {
if(e.getAction() == TouchEvent.ACTION_UP) {
isPressed = false;
mReplayButtonSprite.setY(mReplayButtonSprite.getY() - 3f);
if (Hoppy_Girl.currentState == Hoppy_Girl.GAMESTATE.GAMEOVER) {
if (HoppyGirl.currentState == HoppyGirl.GAMESTATE.GAMEOVER) {
if (gameoverShown) {
resetGame();
selectSound.play();
@ -216,19 +191,17 @@ public class GameScreen extends Scene implements IOnSceneTouchListener {
mLeaderboardButtonSprite.setAlpha(0f);
attachChild(mLeaderboardButtonSprite);
//Add get ready
float grW = mGetReadyRegion.getWidth() * 1.50f, grH = mGetReadyRegion.getHeight() * 1.50f;
mGetReadySprite = new Sprite((mCamera.getWidth() - grW) * 0.5f, 90f, mGetReadyRegion, mEngine.getVertexBufferObjectManager());
mGetReadySprite.setSize(grW, grH);
attachChild(mGetReadySprite);
//Add crown icon
mCrownSprite = new Sprite(mGameoverSprite.getWidth() * 0.5f + mGameoverSprite.getX() + 140f, mGameoverSprite.getY() + 4f, mCrownRegion, mEngine.getVertexBufferObjectManager());
mCrownSprite.setAlpha(0f);
mCrownSprite.setZIndex(103);
attachChild(mCrownSprite);
setScoresDigits(mCamera.getWidth() - 15f, 42f, 7); //setup score digits on game screen
setScoresDigits(mCamera.getWidth() - 15f, 42f, 7);
sortChildren();
hideScoreMain();
@ -237,11 +210,9 @@ public class GameScreen extends Scene implements IOnSceneTouchListener {
@Override
public void onManagedUpdate(final float mSecondsElapsed){
if(Hoppy_Girl.currentState == Hoppy_Girl.GAMESTATE.READY || Hoppy_Girl.currentState == Hoppy_Girl.GAMESTATE.RUNNING || Hoppy_Girl.currentState == Hoppy_Girl.GAMESTATE.GAMEOVER) {
if(HoppyGirl.currentState == HoppyGirl.GAMESTATE.READY || HoppyGirl.currentState == HoppyGirl.GAMESTATE.RUNNING || HoppyGirl.currentState == HoppyGirl.GAMESTATE.GAMEOVER) {
//------------ basic elements ------------------------
//Infinite floors and clouds
if(Hoppy_Girl.currentState == Hoppy_Girl.GAMESTATE.READY || Hoppy_Girl.currentState == Hoppy_Girl.GAMESTATE.RUNNING) {
if(HoppyGirl.currentState == HoppyGirl.GAMESTATE.READY || HoppyGirl.currentState == HoppyGirl.GAMESTATE.RUNNING) {
moveFloors();
moveClouds();
removeOffscreenCloud();
@ -251,7 +222,7 @@ public class GameScreen extends Scene implements IOnSceneTouchListener {
}
//---------- obstacles ------------------
if(Hoppy_Girl.currentState == Hoppy_Girl.GAMESTATE.RUNNING) {
if(HoppyGirl.currentState == HoppyGirl.GAMESTATE.RUNNING) {
//----------------------- INCREMENT SCORE --------------------------
// mTime += mSecondsElapsed;
@ -266,11 +237,10 @@ public class GameScreen extends Scene implements IOnSceneTouchListener {
}
//---------------------- CRYSTALS -----------------------------------
//Move crystals
moveCrystalObstacles();
removeOffscreenCrystalObstacles();
//Create crystal obstacle
float speedIndependentCrystalCurrentInterval = (5f / FLOOR_VELOCITY) * crystalObstacleCurrentInterval;
if (crystalObstacleCtr >= speedIndependentCrystalCurrentInterval) {
spawnCrystalObstacle();
@ -286,15 +256,13 @@ public class GameScreen extends Scene implements IOnSceneTouchListener {
crystalObstacleCtr = 0;
}
//update obstacle counter.
crystalObstacleCtr++;
//check collisions with crystal
for(CrystalObstacles crys : lstCrystalO){
if(mPlayer.playerCollidesWith(crys.getCollidingRectangles())){
flashWhite();
mPlayer.die();
Hoppy_Girl.currentState = Hoppy_Girl.GAMESTATE.GAMEOVER;
HoppyGirl.currentState = HoppyGirl.GAMESTATE.GAMEOVER;
registerUpdateHandler(new TimerHandler(1f, new ITimerCallback() {
@Override
public void onTimePassed(TimerHandler pTimerHandler) {
@ -315,25 +283,22 @@ public class GameScreen extends Scene implements IOnSceneTouchListener {
mPlayer.update(mSecondsElapsed);
//---------------------------------------------------
}
super.onManagedUpdate(mSecondsElapsed);
}
@Override
public boolean onSceneTouchEvent(Scene scn, TouchEvent e){
if(e.isActionDown()){
if(Hoppy_Girl.currentState != Hoppy_Girl.GAMESTATE.GAMEOVER) {
if (Hoppy_Girl.currentState == Hoppy_Girl.GAMESTATE.READY) {
Hoppy_Girl.currentState = Hoppy_Girl.GAMESTATE.RUNNING;
if(HoppyGirl.currentState != HoppyGirl.GAMESTATE.GAMEOVER) {
if (HoppyGirl.currentState == HoppyGirl.GAMESTATE.READY) {
HoppyGirl.currentState = HoppyGirl.GAMESTATE.RUNNING;
mGetReadySprite.registerEntityModifier(new AlphaModifier(0.5f, 1.0f, 0.0f));
mScoreLabelMainSprite.registerEntityModifier(new AlphaModifier(1f, 0f, 1f));
showScoreMain(0);
}
if (Hoppy_Girl.currentState != Hoppy_Girl.GAMESTATE.GAMEOVER)
if (HoppyGirl.currentState != HoppyGirl.GAMESTATE.GAMEOVER)
mPlayer.jump();
}
}
@ -553,7 +518,7 @@ public class GameScreen extends Scene implements IOnSceneTouchListener {
public void resetGame(){
clearCrystalObstacles();
mScoreLabelMainSprite.setAlpha(0f);
Hoppy_Girl.currentState = Hoppy_Girl.GAMESTATE.READY;
HoppyGirl.currentState = HoppyGirl.GAMESTATE.READY;
mPlayer.reset();
hideGameOver();
hideScoreMain();
@ -565,8 +530,6 @@ public class GameScreen extends Scene implements IOnSceneTouchListener {
unregisterTouchArea(mReplayButtonSprite);
unregisterTouchArea(mLeaderboardButtonSprite);
sortChildren();
//show white cover
((Hoppy_Girl)mActivity).hideAds();
hideScoreboardScores();
stopCrownIconFlash();
mLeaderboardButtonSprite.registerEntityModifier(new AlphaModifier(0.2f, 1f, 0f));
@ -611,9 +574,8 @@ public class GameScreen extends Scene implements IOnSceneTouchListener {
mLeaderboardButtonSprite.registerEntityModifier(new AlphaModifier(0.4f, 0.0f, 0.3f));
mReplayButtonSprite.registerEntityModifier(new AlphaModifier(0.4f, 0.0f, 1f));
gameoverShown = true;
((Hoppy_Girl)mActivity).showAds();
Hoppy_Girl mGame = (Hoppy_Girl)mActivity;
HoppyGirl mGame = (HoppyGirl)mActivity;
int HS = mGame.getBestScore();
if(gameScore > HS){
mGame.saveBestScore(gameScore);

View File

@ -1,4 +1,4 @@
package com.hkri.HoppyGirl;
package com.hkri.hoppygirl;
import android.app.ActionBar;
import android.content.Context;
@ -18,34 +18,22 @@ import org.andengine.entity.scene.background.Background;
import org.andengine.entity.util.FPSLogger;
import org.andengine.opengl.view.RenderSurfaceView;
import org.andengine.ui.activity.SimpleBaseGameActivity;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
import org.andengine.util.debug.Debug;
import java.io.*;
public class Hoppy_Girl extends SimpleBaseGameActivity {
public class HoppyGirl extends SimpleBaseGameActivity {
//Best score
static int BESTSCORE = 0;
//Objects
private Camera camera;
//AdView
public AdView myAd;
//Screens
SplashScreen splash;
StartScreen sStart;
GameScreen sGame;
//Current game state
public static GAMESTATE currentState = GAMESTATE.SPLASH;
//Game states
public static enum GAMESTATE{
SPLASH,
START,
@ -59,22 +47,12 @@ public class Hoppy_Girl extends SimpleBaseGameActivity {
protected void onSetContentView(){
mRenderSurfaceView = new RenderSurfaceView(this);
mRenderSurfaceView.setRenderer(mEngine, this);
AdRequest adreq = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("CC5F2C72DF2B356BBF0DA198")
.build();
final FrameLayout frameLayout = new FrameLayout(this);
final FrameLayout.LayoutParams frameLayoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
final FrameLayout.LayoutParams adViewLayoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.TOP | Gravity.CENTER_HORIZONTAL);
myAd = new AdView(this);
myAd.setAdSize(AdSize.BANNER);
myAd.setAdUnitId(getResources().getString(R.string.ad_unit_id));
myAd.loadAd(adreq);
myAd.setVisibility(View.INVISIBLE);
frameLayout.addView(mRenderSurfaceView, super.createSurfaceViewLayoutParams());
frameLayout.addView(myAd, adViewLayoutParams);
setContentView(frameLayout, frameLayoutParams);
}
@ -82,23 +60,16 @@ public class Hoppy_Girl extends SimpleBaseGameActivity {
@Override
public EngineOptions onCreateEngineOptions() {
//Compute camera size by aspect ratio.
//Pick some value for your height.
float cameraHeight = 380;
//Get the display metrics object.
final DisplayMetrics displayMetrics = new DisplayMetrics();
//Populate it with data about your display.
this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
//Calculate the aspect ratio of the device.
float aspectRatio = (float) displayMetrics.widthPixels / (float) displayMetrics.heightPixels;
//Multiply the aspect ratio by the fixed height.
float cameraWidth = Math.round(aspectRatio * cameraHeight);
//Create the camera using those values.
camera = new Camera(0, 0, cameraWidth, cameraHeight);
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(), camera);
@ -113,11 +84,9 @@ public class Hoppy_Girl extends SimpleBaseGameActivity {
}
@Override
public Scene onCreateScene(){
//Retrieve best score.
public Scene onCreateScene() {
retrieveBestScore();
//Start on splash screen.
splash = new SplashScreen(this, this.getTextureManager(), mEngine, camera);
return splash;
}
@ -162,31 +131,13 @@ public class Hoppy_Girl extends SimpleBaseGameActivity {
}
public void setGameOnStarting(){
Hoppy_Girl.currentState = GAMESTATE.START;
HoppyGirl.currentState = GAMESTATE.START;
sStart = new StartScreen(this, getTextureManager(), mEngine, camera);
mEngine.setScene(sStart);
}
public void hideAds(){
runOnUiThread(new Runnable() {
@Override
public void run() {
myAd.setVisibility(View.INVISIBLE);
}
});
}
public void showAds(){
runOnUiThread(new Runnable() {
@Override
public void run() {
myAd.setVisibility(View.VISIBLE);
}
});
}
public void setGameonGameScene(){
Hoppy_Girl.currentState = Hoppy_Girl.GAMESTATE.READY;
HoppyGirl.currentState = HoppyGirl.GAMESTATE.READY;
sGame = new GameScreen(this, getTextureManager(), mEngine, camera);
mEngine.setScene(sGame);
}

View File

@ -1,4 +1,4 @@
package com.hkri.HoppyGirl;
package com.hkri.hoppygirl;
import org.andengine.audio.sound.Sound;
import org.andengine.audio.sound.SoundFactory;

View File

@ -1,4 +1,4 @@
package com.hkri.HoppyGirl;
package com.hkri.hoppygirl;
import org.andengine.engine.camera.Camera;
import org.andengine.engine.handler.timer.ITimerCallback;
@ -56,7 +56,7 @@ public class SplashScreen extends Scene{
coveratlas.load();
//Setup screen.
setBackground(new Background(Hoppy_Girl.getClr(237), Hoppy_Girl.getClr(237), Hoppy_Girl.getClr(237)));
setBackground(new Background(HoppyGirl.getClr(237), HoppyGirl.getClr(237), HoppyGirl.getClr(237)));
setupContents();
//Splash animation: fade in and out and unload.
@ -76,7 +76,7 @@ public class SplashScreen extends Scene{
mEngine.unregisterUpdateHandler(pTimerHandler);
//Dispose elements.
detachChildren();
((Hoppy_Girl)actvt).setGameOnStarting();
((HoppyGirl)actvt).setGameOnStarting();
disposeScene();
}
}));

View File

@ -1,4 +1,4 @@
package com.hkri.HoppyGirl;
package com.hkri.hoppygirl;
import org.andengine.engine.camera.Camera;
import org.andengine.engine.Engine;
@ -89,7 +89,7 @@ public class StartScreen extends Scene implements IOnSceneTouchListener {
cover.registerEntityModifier(new AlphaModifier(0.3f, 1.0f, 0.0f));
//Set scene.
setBackground(new Background(Hoppy_Girl.getClr(237), Hoppy_Girl.getClr(237), Hoppy_Girl.getClr(237)));
setBackground(new Background(HoppyGirl.getClr(237), HoppyGirl.getClr(237), HoppyGirl.getClr(237)));
//Add player
addPlayer();
@ -194,7 +194,7 @@ public class StartScreen extends Scene implements IOnSceneTouchListener {
protected void onModifierFinished(IEntity pItem){
//Unload scene.
detachChildren();
((Hoppy_Girl)mActivity).setGameonGameScene();
((HoppyGirl)mActivity).setGameonGameScene();
disposeScene();
}
});

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Hoppy Girl</string>
<string name = "ad_unit_id">ca-app-pub-4163275117282430/4666967907</string>
<string name="ad_unit_id">ca-app-pub-4163275117282430/4666967907</string>
</resources>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppFullScreenTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>

4
build.gradle Normal file
View File

@ -0,0 +1,4 @@
plugins {
id("com.android.application") version '8.2.2' apply false
id("com.android.library") version '8.2.2' apply false
}

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
#Sat Feb 03 17:40:25 PST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

244
gradlew vendored Executable file
View File

@ -0,0 +1,244 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

92
gradlew.bat vendored Normal file
View File

@ -0,0 +1,92 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -1,20 +0,0 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@ -1,17 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-15
android.library=false
android.library.reference.1=../../Documents/Programming/~Libraries/AndEngine-GLES2
android.library.reference.2=../../../../adt-bundle-windows-x86_64-20131030/sdk/extras/google/google_play_services/libproject/google-play-services_lib

15
settings.gradle Normal file
View File

@ -0,0 +1,15 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}
rootProject.name = "hoppy-girl"
include ("app")