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

Feature/storyy #585

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
39 changes: 23 additions & 16 deletions source/core/assets/images/npc/Astronaut.atlas
Original file line number Diff line number Diff line change
Expand Up @@ -3,115 +3,122 @@ size: 512, 32
format: RGBA8888
filter: Nearest, Nearest
repeat: none
Astro_Up
row-1-column-1
rotate: false
xy: 0, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Up
row-1-column-2
rotate: false
xy: 32, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Up
row-1-column-3
rotate: false
xy: 64, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Up
row-1-column-4
rotate: false
xy: 96, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Left
row-2-column-1
rotate: false
xy: 128, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Left
row-2-column-2
rotate: false
xy: 160, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Left
row-2-column-3
rotate: false
xy: 192, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Left
row-2-column-4
rotate: false
xy: 224, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Down
row-3-column-1
rotate: false
xy: 256, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Down
row-3-column-2
rotate: false
xy: 288, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Down
row-3-column-3
rotate: false
xy: 320, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Down
row-3-column-4
rotate: false
xy: 352, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Right
row-4-column-1
rotate: false
xy: 384, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Right
row-4-column-2
rotate: false
xy: 416, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Right
row-4-column-3
rotate: false
xy: 448, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Right
row-4-column-4
rotate: false
xy: 480, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
Astro_Stand
rotate: false
xy: 256, 0
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
2 changes: 1 addition & 1 deletion source/core/assets/kenney-rpg-expansion/kenneyrpg.json
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
"titleFont": "thick_white"
},
"dialogue_7": {
"background": "dialogue_6",
"background": "dialogue_7",
"titleFont": "thick_white"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"entities": [
{
"class": "com.csse3200.game.entities.configs.AstronautConfig",
"spritePath": "images/npc/astronaut_npc.atlas",
"spritePath": "images/npc/Astronaut.atlas",
"position" : {
"x": 15,
"y": 38
Expand Down
4 changes: 4 additions & 0 deletions source/core/assets/levels/cryoheim/main_area/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
"map/heatzone.png",
"particle-effects/explosion/particle.png",
"images/npc/astronaut_npc.png",
"images/npc/Astronaut.png",
"images/space_navigation_planet_2.png","images/upgradetree/sword.png",
"images/space_navigation_planet_2.png","images/upgradetree/sword.png",
"images/companion/Laboratorycryoheim.png"

],
"textureAtlasPaths": [
"images/troll_enemy.atlas",
Expand All @@ -36,6 +39,7 @@
"images/boss_enemy.atlas",
"images/botanist.atlas",
"images/weapons/wrench.atlas",
"images/npc/Astronaut.atlas",
"images/npc/astronaut_npc.atlas",
"images/botanist.atlas"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"entities": [
{
"class": "com.csse3200.game.entities.configs.AstronautConfig",
"spritePath": "images/npc/astronaut_npc.atlas",
"spritePath": "images/npc/Astronaut.atlas",
"position" : {
"x": 13,
"y": 40
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void create() {
animator = entity.getComponent(AnimationRenderComponent.class);

// Start with the default animation.
animator.startAnimation("row-1-column-1");
animator.startAnimation("Astro_Stand");
}

@Override
Expand All @@ -48,25 +48,11 @@ public void update() {

// Switch between animations.
switch (animator.getCurrentAnimation()) {
case "row-1-column-1" -> animator.startAnimation("row-1-column-2");
case "row-1-column-2" -> animator.startAnimation("row-1-column-3");
case "row-1-column-3" -> animator.startAnimation("row-1-column-4");
case "row-1-column-4" -> animator.startAnimation("row-2-column-1");
case "row-2-column-1" -> animator.startAnimation("row-2-column-2");
case "row-2-column-2" -> animator.startAnimation("row-2-column-3");
case "row-2-column-3" -> animator.startAnimation("row-2-column-4");
case "row-2-column-4" -> animator.startAnimation("row-3-column-1");
case "row-3-column-1" -> animator.startAnimation("row-3-column-2");
case "row-3-column-2" -> animator.startAnimation("row-3-column-3");
case "row-3-column-3" -> animator.startAnimation("row-3-column-4");
case "row-3-column-4" -> animator.startAnimation("row-4-column-1");
case "row-4-column-1" -> animator.startAnimation("row-4-column-2");
case "row-4-column-2" -> animator.startAnimation("row-4-column-3");
case "row-4-column-3" -> animator.startAnimation("row-4-column-4");
case "row-4-column-4" -> animator.startAnimation("row-1-column-1");
case "Astro_Left" -> animator.startAnimation("Astro_Left");
case "Astro_Right" -> animator.startAnimation("Astro_Right");
default ->
// Default to the bottom animation if not in any specific state.
animator.startAnimation("row-1-column-1");
animator.startAnimation("Astro_Stand");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public static Entity createBotanist(BotanistConfig config) {
"{SLOW}I will give you all the Knowledge I have, \nto find a suitable planet for your Journey "};
String[] titletext= {"",""};
String[] window = {"dialogue_7", "dialogue_7"};

TitleBox titleBox = new TitleBox(game, titletext, storytext, skin, window);
titleBox.showDialog(ServiceLocator.getRenderService().getStage());
},10f));
Expand Down Expand Up @@ -175,10 +174,12 @@ public static Entity createTutnpc(TutnpcConfig tutnpcConfig) {

tutnpc.getComponent(ColliderComponent.class).setDensity(1.5f);
tutnpc.scaleHeight(0.7f);
String[] storytext = {"I am your Tutorial Guide", "I am here to teach you how to play!"};
String[] titletext = {"", ""};
tutnpc.addComponent(new InteractableComponent(entity -> {
tutnpc.getComponent(DialogComponent.class).showdialogue(storytext, titletext);
String[] storytext = {"I am your Tutorial Guide", "I am here to teach you how to play!"};
String[] titletext = {"", ""};
String[] window = {"dialogue_5", "dialogue_5"};
TitleBox titleBox = new TitleBox(game, titletext, storytext, skin, window);
titleBox.showDialog(ServiceLocator.getRenderService().getStage());
}, 3f));
animator.startAnimation("Tut_StandDown");
return tutnpc;
Expand Down Expand Up @@ -221,10 +222,12 @@ public static Entity createHellman(HellmanConfig hellmanConfig) {

Hellman.getComponent(ColliderComponent.class).setDensity(1.5f);
Hellman.scaleHeight(2.0f);
String[] storytext = {"If you defeat this boss,\n I will help you find a suitable planet", "You will find the boss on the \nother side of the portal."};
String[] titletext = {"", ""};
Hellman.addComponent(new InteractableComponent(entity -> {
Hellman.getComponent(DialogComponent.class).showdialogue(storytext, titletext);
String[] storytext = {"If you defeat this boss,\n I will help you find a suitable planet", "You will find the boss on the \nother side of the portal."};
String[] titletext = {"", ""};
String[] window = {"dialogue_6", "dialogue_6"};
TitleBox titleBox = new TitleBox(game, titletext, storytext, skin, window);
titleBox.showDialog(ServiceLocator.getRenderService().getStage());
}, 3f));
return Hellman;
}
Expand Down Expand Up @@ -258,23 +261,10 @@ public static Entity createAstronaut(AstronautConfig astronautConfig) {
AnimationRenderComponent animator =
new AnimationRenderComponent(
ServiceLocator.getResourceService().getAsset(astronautConfig.spritePath, TextureAtlas.class));
animator.addAnimation("row-1-column-1", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-1-column-2", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-1-column-3", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-1-column-4", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-2-column-1", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-2-column-2", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-2-column-3", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-2-column-4", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-3-column-1", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-3-column-2", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-3-column-3", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-3-column-4", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-4-column-1", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-4-column-2", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-4-column-3", 0.01f, Animation.PlayMode.LOOP);
animator.addAnimation("row-4-column-4", 0.01f, Animation.PlayMode.LOOP);

animator.addAnimation("Astro_Stand", 1f, Animation.PlayMode.NORMAL);
animator.addAnimation("Astro_Down", 1f, Animation.PlayMode.LOOP);
animator.addAnimation("Astro_Left", 1f, Animation.PlayMode.LOOP);
animator.addAnimation("Astro_Right", 1f, Animation.PlayMode.LOOP);

Entity astronaut =
new Entity()
Expand All @@ -293,12 +283,10 @@ public static Entity createAstronaut(AstronautConfig astronautConfig) {
astronaut.addComponent(new InteractableComponent(entity -> {
String[] storytext= {"Hello, I've been stuck here for weeks","Can I please come with you?"};
String[] titletext= {"",""};
astronaut.getComponent(DialogComponent.class).showdialogue(storytext,titletext);
// Since Dialogue Box does not show up on screen, cannot 'exit' dialogue box therefore
// the 'resumeGame' function is never called. This code is to ensure gameplay can continue
for (Entity mainGame : ServiceLocator.getEntityService().getEntitiesByComponent(MainGameActions.class)) {
mainGame.getEvents().trigger("resumeGame");
}
String[] window = {"dialogue_4", "dialogue_4"};
TitleBox titleBox = new TitleBox(game, titletext, storytext, skin, window);
titleBox.showDialog(ServiceLocator.getRenderService().getStage());

},1f));

astronaut.scaleHeight(1f);
Expand Down Expand Up @@ -329,7 +317,6 @@ public static Entity createJail(JailConfig jailConfig) {
,"{SLOW}Player: We can handle it. \n Let me Lead the way!"};
String[] titletext= {"","",""};
String[] window = {"dialogue_1", "dialogue_1","dialogue_3"};

TitleBox titleBox = new TitleBox(game, titletext, storytext, skin, window);
titleBox.showDialog(ServiceLocator.getRenderService().getStage());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class AstronautAnimationControllerTest {
void setUp() {
MockitoAnnotations.openMocks(this);

when(assetManager.get("images/npc/astronaut_npc.atlas")).thenReturn(atlas);
// when(assetManager.get("images/npc/astronaut_npc.atlas")).thenReturn(atlas);
when(assetManager.get("images/npc/Astronaut.atlas")).thenReturn(atlas);

controller = new AstronautAnimationController();

Expand All @@ -49,7 +50,7 @@ void setUp() {
void testCreate() {
controller.create();

verify(animator).startAnimation("row-1-column-1");
verify(animator).startAnimation("Astro_Stand");

}

Expand Down
Loading