Skip to content

Commit

Permalink
Merge pull request #1 from Neeltyper001/feature
Browse files Browse the repository at this point in the history
Feature
  • Loading branch information
Neeltyper001 authored Jan 10, 2024
2 parents 97181a0 + 28cf922 commit 378bcb1
Show file tree
Hide file tree
Showing 35 changed files with 430 additions and 157 deletions.
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@ https://github.com/Neeltyper001/Raider_Vs_Soldier/assets/80151802/c8e706f3-f3ee-

## Controls

- **'A'**: Move Left
- **'S'**: Move Down
- **'W'**: Move Up
- **'D'**: Move Right
- **`A`**: Move Left ⬅️
- **`S`**: Move Down ⬇️
- **`W`**: Move Up ⬆️
- **`D`**: Move Right ➡️
- **`J`**: Shoot Enemies 🔫
- **`Q`**: To Run 🏃

## Goal

The goal of the game is to score as many points as possible while fending off endless waves of soldiers. Use the controls wisely to navigate through the battlefield and defend your base.
The goal of the game is to score as many points as possible while defending off endless waves of soldiers. Use the controls wisely to navigate through the battlefield and defend your base.

## Gameplay Video

[Watch Gameplay Video](./Assets/Raider_vs_soldier_gameplay.mp4)

## Game Download link
[Download Game from here](https://github.com/Neeltyper001/Raider_Vs_Soldier/raw/main/Raider-Vs-Soldier.zip)

## Contributing

If you encounter any bugs, have suggestions, or want to contribute to the development, please check the [Contributing Guidelines](CONTRIBUTING.md).
Expand All @@ -29,8 +34,9 @@ This project is licensed under the [MIT License](LICENSE).

Enjoy playing Raider_Vs_Soldier! 👾

## Future Scope
While this game is currently in its early stage, future scope regarding this project can be focused upon following
- Adding tank as a valuable ally
- Sound Effects
### AND SOMETHING MORE !!
## Future Ideas
While this game is currently in its early stage, future ideas regarding this project can be following
- Adding an important ally that can fight alongside with you.
- Consumable items such as health kit etc.

### AND MANY MORE !!
Binary file added Raider-Vs-Soldier.zip
Binary file not shown.
Binary file added resource/Enemy/Dead_rev.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/audio/effects/game_over.mp3
Binary file not shown.
Binary file added resource/audio/effects/game_over_2.mp3
Binary file not shown.
Binary file added resource/audio/effects/game_over_2.wav
Binary file not shown.
Binary file added resource/audio/effects/game_start.wav
Binary file not shown.
Binary file added resource/audio/effects/game_start_2.wav
Binary file not shown.
Binary file added resource/audio/effects/gun_shot.mp3
Binary file not shown.
Binary file added resource/audio/effects/gun_shot.wav
Binary file not shown.
Binary file added resource/audio/music/game_music.mp3
Binary file not shown.
Binary file added resource/audio/music/game_music_2.wav
Binary file not shown.
Binary file added resource/splashScreen/game_splash_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions src/Graphics/SplashScreen.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package Graphics;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JWindow;

import com.audios.GameStartEffect;
import com.constants.GameConstants;
import com.constants.GameResourcesPath;
import com.constants.TemporalConstants;

public class SplashScreen extends JWindow implements GameResourcesPath,GameConstants,TemporalConstants{
private JLabel label = new JLabel();
private GameStartEffect gameStartEffect = new GameStartEffect();

public SplashScreen() {
setSize(SPLASH_SCREEN_WIDTH,SPLASH_SCREEN_HEIGHT);
Icon icon = new ImageIcon(SplashScreen.class.getResource(SPLASH_SCREEN));
label.setIcon(icon);
this.add(label);
setLocationRelativeTo(null);
setVisible(true);
gameStartEffect.playGameStart();
try {
Thread.sleep(FIVE_SECONDS);
setVisible(false);
dispose();
} catch(Exception e) {
e.printStackTrace();
}
}
}
13 changes: 12 additions & 1 deletion src/com/animations/EnemyAnimations.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ public class EnemyAnimations implements GameResourcesPath,Actions{

private BufferedImage mainWalkingImage;
private BufferedImage mainAttackingImage;
private BufferedImage mainDeadImage;
private BufferedImage walking [];
private BufferedImage attacking [];
private BufferedImage dead [];


public EnemyAnimations() {
this.mainWalkingImage = new Sprites(ENEMY_WALKING).getImage();
this.mainAttackingImage = new Sprites(ENEMY_ATTACKING).getImage();
this.mainDeadImage = new Sprites(ENEMY_DEAD).getImage();
this.initEnemyWalkingAnimation();
this.initEnemyAttackingAnimation();
this.initEnemyDeadAnimation();
}


Expand All @@ -42,14 +46,21 @@ public void initEnemyAttackingAnimation() {
this.attacking[3] = this.mainAttackingImage.getSubimage(16, 42, 66, 86);
}


public void initEnemyDeadAnimation() {
this.dead = new BufferedImage[4];
this.dead[0] = this.mainDeadImage.getSubimage(427, 42, 45, 86);
this.dead[1] = this.mainDeadImage.getSubimage(297, 42, 45, 86);
this.dead[2] = this.mainDeadImage.getSubimage(181, 42, 45, 86);
this.dead[3] = this.mainDeadImage.getSubimage(39, 42, 68, 86);
}


public BufferedImage[] getEnemyActionAnimation(int actionType) {

switch( actionType ) {
case WALKING : return this.walking;
case ATTACKING: return this.attacking;
case DEAD: return this.dead;
default: return this.walking;

}
Expand Down
5 changes: 5 additions & 0 deletions src/com/animations/MainAnimation.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
import com.entities.Player;
import com.utils.ChangeAnimation;

/** ATTENTION:
MainAnimation class is currently not in use but can have potential in future.
So if one wants to work with it can do whatever they want but make sure **THAT DO NOT REMOVE THIS CLASS**.
Also, currently, this class is not a part of the game build.
*/

public class MainAnimation implements Actions {
ChangeAnimation playerChangeAnimation;
Expand Down
11 changes: 2 additions & 9 deletions src/com/animations/RaiderAnimations.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class RaiderAnimations implements GameResourcesPath,Actions {

// private GamePanel gamePanel;
//default images
private Sprites playerSprites;

private BufferedImage mainIdleImage;
private BufferedImage mainWalkingImage;
private BufferedImage mainRunningImage;
Expand Down Expand Up @@ -45,7 +45,7 @@ public class RaiderAnimations implements GameResourcesPath,Actions {
private BufferedImage jumpingLeft [];
private BufferedImage hurtingLeft [];
private BufferedImage deadLeft [];
// private boolean initFlag = false;


public RaiderAnimations() {
this.mainIdleImage = new Sprites(RAIDER_IDLE).getImage();
Expand All @@ -71,17 +71,12 @@ public RaiderAnimations() {
this.initRaiderAttackingAnimation();
this.initRaiderJumpAnimation();
this.initRaiderHurtingAnimation();
// this.initRaiderDeadAnimation();

// Left animation initialization
this.initRaiderIdleLeftAnimation();
this.initRaiderWalkingLeftAnimation();
this.initRaiderRunningLeftAnimation();
this.initRaiderAttackingLeftAnimation();
this.initRaiderJumpLeftAnimation();
this.initRaiderHurtingLeftAnimation();
// this.initRaiderDeadLeftAnimation();
// this.initFlag = true;
}

//Default animations
Expand Down Expand Up @@ -235,8 +230,6 @@ public BufferedImage[] getRaiderActionAnimation(int actionType,int actionDirecti
case RUNNING: return actionDirection == RIGHT_DIRECTION ? this.running : this.runningLeft;
case ATTACKING: return actionDirection == RIGHT_DIRECTION ? this.attacking : this.attackingLeft;
case WALKING_VERTICAL: return actionDirection == RIGHT_DIRECTION ? this.walking : this.walkingLeft;
// case HURTING: return actionDirection == RIGHT_DIRECTION ? this.hurting : this.hurtingLeft;
// case DEAD: return actionDirection == RIGHT_DIRECTION ? this.dead : this.deadLeft;
default: return actionDirection == RIGHT_DIRECTION ? this.idle : this.idleLeft;

}
Expand Down
51 changes: 51 additions & 0 deletions src/com/audios/GameMusic.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.audios;


import java.io.IOException;
import java.net.URL;

import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;


import com.constants.GameResourcesPath;


public class GameMusic implements GameResourcesPath{

private AudioInputStream audioInputStream;
private URL gameMusicUrl;
private Clip gameMusicClip;

public GameMusic(){
this.createGameMusicURL();
this.getGameMusicPlayer();
}

private void getGameMusicPlayer() {
try {
this.audioInputStream = AudioSystem.getAudioInputStream(gameMusicUrl);
this.gameMusicClip = AudioSystem.getClip();
this.gameMusicClip.open(this.audioInputStream);
} catch (UnsupportedAudioFileException | IOException | LineUnavailableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

private void createGameMusicURL() {
this.gameMusicUrl = getClass().getResource(GAME_MUSIC_2);
}

public void playGameMusic() {
this.gameMusicClip.loop(Clip.LOOP_CONTINUOUSLY);
}

public void stopGameMusic() {
this.gameMusicClip.stop();
}
}
48 changes: 48 additions & 0 deletions src/com/audios/GameOverEffect.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.audios;

import java.io.IOException;
import java.net.URL;

import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;

import com.constants.GameResourcesPath;


public class GameOverEffect implements GameResourcesPath {
private AudioInputStream audioInputStream;
private URL gameOverUrl;
private Clip gameOverClip;

public GameOverEffect(){
this.createGameOverURL();
this.getGameOverPlayer();
}

private void getGameOverPlayer() {
try {
this.audioInputStream = AudioSystem.getAudioInputStream(gameOverUrl);
this.gameOverClip = AudioSystem.getClip();
this.gameOverClip.open(this.audioInputStream);
} catch (UnsupportedAudioFileException | IOException | LineUnavailableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

private void createGameOverURL() {
this.gameOverUrl = getClass().getResource(GAME_OVER_2);
}

public void playGameOver() {
this.gameOverClip.start();
}

public void stopGameOver() {
this.gameOverClip.stop();
}
}
47 changes: 47 additions & 0 deletions src/com/audios/GameStartEffect.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.audios;

import java.io.IOException;
import java.net.URL;

import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;

import com.constants.GameResourcesPath;

public class GameStartEffect implements GameResourcesPath {
private AudioInputStream audioInputStream;
private URL gameStartUrl;
private Clip gameStartClip;

public GameStartEffect(){
this.createGameStartURL();
this.getGameStartPlayer();
}

private void getGameStartPlayer() {
try {
this.audioInputStream = AudioSystem.getAudioInputStream(gameStartUrl);
this.gameStartClip = AudioSystem.getClip();
this.gameStartClip.open(this.audioInputStream);
} catch (UnsupportedAudioFileException | IOException | LineUnavailableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

private void createGameStartURL() {
this.gameStartUrl = getClass().getResource(GAME_START_2);
}

public void playGameStart() {
this.gameStartClip.start();
}

public void stopGameStart() {
this.gameStartClip.stop();
}
}
48 changes: 48 additions & 0 deletions src/com/audios/GunShotEffect.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.audios;

import java.io.IOException;
import java.net.URL;

import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;

import com.constants.GameResourcesPath;

public class GunShotEffect implements GameResourcesPath {
private AudioInputStream audioInputStream;
private URL gunShotUrl;
private Clip gunShotClip;

public GunShotEffect(){
this.createGunShotURL();
this.getGunShotPlayer();
}

private void getGunShotPlayer() {
try {
this.audioInputStream = AudioSystem.getAudioInputStream(gunShotUrl);
this.gunShotClip = AudioSystem.getClip();
this.gunShotClip.open(this.audioInputStream);
} catch (UnsupportedAudioFileException | IOException | LineUnavailableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

private void createGunShotURL() {
this.gunShotUrl = getClass().getResource(GUN_SHOT_2);
}

public void playGunShot() {
this.gunShotClip.setMicrosecondPosition(0);
this.gunShotClip.loop(Clip.LOOP_CONTINUOUSLY);
}

public void stopGunShot() {
this.gunShotClip.stop();
}
}
5 changes: 5 additions & 0 deletions src/com/constants/AnimationConstants.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package com.constants;

public interface AnimationConstants {
// PLAYER ANIMATION
int ANIMATION_TICK=0;
int ANIMATION_STARTING_INDEX = 0;
int ANIMATION_TICK_LIMIT = 15;

// ENEMY ANIMATION
int ENEMY_ANIMATION_TICK=0;
int ENEMY_ANIMATION_STARTING_INDEX = 0;
int ENEMY_ANIMATION_TICK_LIMIT = 15;
}
Loading

0 comments on commit 378bcb1

Please sign in to comment.