Skip to content

Commit

Permalink
mereg conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
lyphng committed Oct 18, 2022
2 parents 5b1c0e2 + 58b9abc commit b06d7a9
Show file tree
Hide file tree
Showing 114 changed files with 3,650 additions and 2,488 deletions.
Binary file modified .DS_Store
Binary file not shown.
1,054 changes: 592 additions & 462 deletions source/core/assets/flat-earth/skin/flat-earth-ui.json

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/core/assets/images/Skill_tree/skill_tree_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/core/assets/images/Skills/skill-tree-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,417 changes: 796 additions & 621 deletions source/core/assets/images/Skills/skillAnimations.atlas

Large diffs are not rendered by default.

Binary file modified source/core/assets/images/Skills/skillAnimations.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 source/core/assets/images/Skills/skillbar.png
Binary file modified source/core/assets/images/level_1_tiledmap/minimap1.png
Binary file modified source/core/assets/images/level_2_tiledmap/minimap2.png
Binary file added source/core/assets/sounds/Dialogue/ALONE.wav
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added source/core/assets/sounds/Dialogue/LEAVE.wav
Binary file not shown.
Binary file added source/core/assets/sounds/Dialogue/ME.wav
Binary file not shown.
Binary file modified source/core/assets/sounds/Ora.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/charge.mp3
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package com.deco2800.game.SkillsTree;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.deco2800.game.components.player.*;
import com.deco2800.game.entities.Entity;
import com.deco2800.game.entities.EntityService;
import com.deco2800.game.services.ServiceLocator;
import com.deco2800.game.ui.UIComponent;
import org.slf4j.Logger;
Expand All @@ -32,13 +30,17 @@ public class SkillsTreeDisplay extends UIComponent {
private Table exitTable;
private Table equipTable;
private Image skillTreeImage;
private Image skillbarImage;
private boolean skillTreeOpen = false;
private ArrayList<ImageButton> skillTreeIcons = new ArrayList<>();
private Image activeTooltip;
private boolean toolTipDisplaying;

private PlayerSkillComponent.SkillTypes skill1Type = PlayerSkillComponent.SkillTypes.NONE;
private PlayerSkillComponent.SkillTypes skill2Type = PlayerSkillComponent.SkillTypes.NONE;
private PlayerSkillComponent.SkillTypes skill3Type = PlayerSkillComponent.SkillTypes.NONE;


@Override
public void create() {
entity.getEvents().addListener("toggleSkillTree", this::toggleSkillTreeDisplay);
Expand Down Expand Up @@ -71,10 +73,7 @@ private void addActors() {
exitTable = new Table();
equipTable = new Table();
equipTable.bottom().left();
Pixmap bgPixmap = new Pixmap(1,1, Pixmap.Format.RGB565);
bgPixmap.setColor(Color.TEAL);
bgPixmap.fill();
TextureRegionDrawable textureRegionDrawableBg = new TextureRegionDrawable(new TextureRegion(new Texture(bgPixmap)));
TextureRegionDrawable textureRegionDrawableBg = new TextureRegionDrawable(new TextureRegion(new Texture("images/Skill_tree/skill tree background.png")));
skillTreeBackground.setBackground(textureRegionDrawableBg);
exitTable.top().right();
exitTable.setFillParent(true);
Expand All @@ -83,11 +82,20 @@ private void addActors() {
skillTreeImage = new Image(new Texture(Gdx.files.internal("images/Skill_tree/skill_tree_2.png")));
skillTreeImage.setSize(850f, 850f);
skillTreeImage.setPosition(250,0);



TextButton mainMenuBtn = new TextButton("Exit", skin);
mainMenuBtn.addListener(
skillbarImage = new Image(new Texture("images/Skills/skillbar.png"));
skillbarImage.setSize(350,160);
skillbarImage.setPosition( 280, -45);


TextureRegionDrawable exitTextureUp = new TextureRegionDrawable(ServiceLocator.getResourceService()
.getAsset("images/Skills/skillExitButton.png", Texture.class));
TextureRegionDrawable exitTextureDown = new TextureRegionDrawable(ServiceLocator.getResourceService()
.getAsset("images/Skills/skillExitButtonDown.png", Texture.class));
ImageButton exitButton = new ImageButton(exitTextureUp);
ImageButton.ImageButtonStyle style = exitButton.getStyle();
style.imageUp = exitTextureUp;
style.imageDown = exitTextureDown;
exitButton.addListener(
new ChangeListener() {
@Override
public void changed(ChangeEvent changeEvent, Actor actor) {
Expand All @@ -96,13 +104,14 @@ public void changed(ChangeEvent changeEvent, Actor actor) {
}
});

exitTable.add(mainMenuBtn).padTop(10f).padRight(10f);
exitTable.add(exitButton).padTop(10f).padRight(10f);

refreshEquippedSkillsUI();

stage.addActor(skillTreeBackground);
stage.addActor(exitTable);
stage.addActor(skillTreeImage);
stage.addActor(skillbarImage);
stage.addActor(equipTable);
addAllSkillsToTree();
}
Expand All @@ -121,13 +130,13 @@ private void addAllSkillsToTree() {
if (playerSkillPoints >= 0) {
row1Lock = false;
}
if (playerSkillPoints >= 0) {
if (playerSkillPoints >= 1) {
row2Lock = false;
}
if (playerSkillPoints >= 0) {
if (playerSkillPoints >= 3) {
row3Lock = false;
}
if (playerSkillPoints >= 0) {
if (playerSkillPoints >= 6) {
row4Lock = false;
}

Expand Down Expand Up @@ -181,6 +190,11 @@ public void dispose() {
skillTreeImage.remove();
}

if (skillbarImage != null) {
skillbarImage.clear();
skillbarImage.remove();
}

if (!skillTreeIcons.isEmpty()) {
for (ImageButton button : skillTreeIcons) {
button.clear();
Expand Down Expand Up @@ -258,51 +272,51 @@ private void addEquippedSkill(PlayerSkillComponent.SkillTypes skillType, int ski
case NONE -> addEquipImage("blankSkillIcon");
case DASH -> {
addEquipImage("dash");
addCountdownTrigger("dashCountdown", skillNum);
addCountdownTrigger("dashCountdown", skillNum, 500);
}
case TELEPORT -> {
addEquipImage("teleport");
addCountdownTrigger("teleportCountdown", skillNum);
addCountdownTrigger("teleportCountdown", skillNum, 10000);
}
case BLOCK -> {
addEquipImage("block");
addCountdownTrigger("blockCountdown", skillNum);
addCountdownTrigger("blockCountdown", skillNum, 3000);
}
case DODGE -> {
addEquipImage("dodge");
addCountdownTrigger("dodgeCountdown", skillNum);
addCountdownTrigger("dodgeCountdown", skillNum, 3000);
}
case FIREBALLULTIMATE -> {
addEquipImage("fireballUltimate");
addCountdownTrigger("fireballCountdown", skillNum);
addCountdownTrigger("fireballCountdown", skillNum, 20000);
}
case ULTIMATE -> {
addEquipImage("ultimate");
addCountdownTrigger("ultimateCountdown", skillNum);
addCountdownTrigger("ultimateCountdown", skillNum, 20000);
}
case ROOT -> {
addEquipImage("root");
addCountdownTrigger("rootCountdown", skillNum);
addCountdownTrigger("rootCountdown", skillNum, 5000);
}
case AOE -> {
addEquipImage("aoe");
addCountdownTrigger("aoeCountdown", skillNum);
addCountdownTrigger("aoeCountdown", skillNum, 5000);
}
case PROJECTILE -> {
addEquipImage("wrenchProjectile");
addCountdownTrigger("wrenchCountdown", skillNum);
addCountdownTrigger("wrenchCountdown", skillNum, 5000);
}
case BLEED -> {
addEquipImage("bleed");
addCountdownTrigger("bleedCountdown", skillNum);
addCountdownTrigger("bleedCountdown", skillNum, 5000);
}
case CHARGE -> {
addEquipImage("charge");
addCountdownTrigger("chargeCountdown", skillNum);
addCountdownTrigger("chargeCountdown", skillNum, 10000);
}
case INVULNERABILITY -> {
addEquipImage("invulnerability");
addCountdownTrigger("invulnerabilityCountdown", skillNum);
addCountdownTrigger("invulnerabilityCountdown", skillNum, 10000);
}
}
}
Expand All @@ -319,9 +333,15 @@ private void addEquipImage(String imageName) {
cooldownBar.addSkillIcon(new Image(new Texture(imagePath)));
}

private void addCountdownTrigger(String listenerName, int skillNum) {
/**
* Adds a countdown trigger to the cooldown display.
* @param listenerName The name of the countdown controller listener
* @param skillNum the equipped skill number, 1 based and up to 3 equipped skills
* @param cooldownLength the length of the cooldown for the countdown visual display
*/
private void addCountdownTrigger(String listenerName, int skillNum, long cooldownLength) {
Countdown countdownController = ServiceLocator.getGameArea().getPlayer().getComponent(Countdown.class);
countdownController.setCountdownTrigger(skillNum, listenerName);
countdownController.setCountdownTrigger(skillNum, listenerName, cooldownLength);
}

/**
Expand Down Expand Up @@ -353,6 +373,7 @@ private void addSkillToTree(int skillNumber, String baseImageFileName, PlayerSki
case 10 -> addSkillTreeButton(844, 344, imageFileName, skillType, disabled);
case 11 -> addSkillTreeButton(781, 210, imageFileName, skillType, disabled);
case 12 -> addSkillTreeButton(850, 210, imageFileName, skillType, disabled);
default -> addSkillTreeButton(0, 0, imageFileName, skillType, disabled);
}
}

Expand Down Expand Up @@ -380,6 +401,18 @@ private void addSkillTreeButton(int xCoord, int yCoord, String imageFilePath, Pl
@Override
public void changed(ChangeEvent event, Actor actor) {
equipSkill(skillType);
removeActiveTooltip();
}
});
button.addListener(new ClickListener() {
@Override
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
addTooltipImage(imageFilePath, xCoord, yCoord);
}

@Override
public void exit(InputEvent event, float x, float y, int pointer, Actor fromActor) {
removeActiveTooltip();
}
});
}
Expand All @@ -388,6 +421,35 @@ public void changed(ChangeEvent event, Actor actor) {
skillTreeIcons.add(button);
}

/**
* Adds tooltip image to skill tree icon.
* @param imageFilePath the name of the skill tree icon
* @param xCoord the x coordinates of the skill icon, taken directly from its placement on the skill tree
* @param yCoord the y coordinates of the skill icon, taken directly from its placement on the skill tree
*/
private void addTooltipImage(String imageFilePath, float xCoord, float yCoord) {
if (!this.toolTipDisplaying) {
this.toolTipDisplaying = true;
this.activeTooltip = new Image(new TextureRegionDrawable(ServiceLocator.getResourceService()
.getAsset("images/Skill_tree/tooltips/" + imageFilePath + "Tooltip.png", Texture.class)));
this.activeTooltip.setPosition(xCoord - SKILL_ICON_BUTTON_SIZE/2f , yCoord + SKILL_ICON_BUTTON_SIZE);
this.activeTooltip.setSize(SKILL_ICON_BUTTON_SIZE * 3f, SKILL_ICON_BUTTON_SIZE * 2f);
stage.addActor(this.activeTooltip);
}

}

/**
* Removes the active tooltip for a skill icon
*/
private void removeActiveTooltip() {
if (this.activeTooltip != null) {
this.activeTooltip.remove();
this.activeTooltip = null;
this.toolTipDisplaying = false;
}
}

/**
* Equips a skill of type from types in PlayerSkillComponent.SkillTypes
* @param skillType, skill of types PlayerSkillComponent.SkillTypes
Expand Down Expand Up @@ -423,12 +485,8 @@ private void equipSkill(PlayerSkillComponent.SkillTypes skillType) {
* false otherwise
*/
private boolean isDuplicateSkillEquip(PlayerSkillComponent.SkillTypes skillType) {
if (skillType == skill1Type || skillType == skill2Type || skillType == skill3Type) {
return true;
} else {
return false;
}
}

return (skillType == skill1Type || skillType == skill2Type || skillType == skill3Type);
}

}
Loading

0 comments on commit b06d7a9

Please sign in to comment.