Skip to content

Commit

Permalink
Twitter route working
Browse files Browse the repository at this point in the history
  • Loading branch information
Chasmiccoder committed Feb 10, 2022
1 parent 5940994 commit 60b4562
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 3 deletions.
Binary file added images/blankGuy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions js/GameObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ class GameObject { // all people
let eventConfig = this.behaviorLoop[this.behaviorLoopIndex];
eventConfig.who = this.id;

// Event config for link teleportation
// eventConfig.link = this.link || '';
// eventConfig.newTab = this.newTab || false;

console.log(eventConfig.link);

// create an event instance out of our next event config
const eventHandler = new OverworldEvent({map, event: eventConfig});
await eventHandler.init(); // wait until the event gets revolved
Expand Down
1 change: 0 additions & 1 deletion js/Overworld.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class Overworld {
new KeyPressListener("Enter", () => {
// is there a person to talk to?
this.map.checkForActionCutscene() // check for a cutscene at a specific position

})
}

Expand Down
15 changes: 15 additions & 0 deletions js/OverworldEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ class OverworldEvent {
constructor({map, event}) {
this.map = map;
this.event = event;

// this.link = event.link
// this.newTab = event.newTab;
}

init() {
Expand Down Expand Up @@ -78,4 +81,16 @@ class OverworldEvent {
sceneTransition.fadeOut();
});
}


redirectPerson(resolve) {
let link = this.event.link;
let newTab = this.event.link || false;
if(newTab) {
window.open(link, '_blank');
} else {
window.open(link);
}
resolve();
}
}
76 changes: 74 additions & 2 deletions js/OverworldMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,28 @@ let diyaPath = [
let diya_cutscene_set_of_coords = [`${12*32},${38*32}`,`${13*32},${38*32}`,`${14*32},${38*32}`,`${15*32},${38*32}`,`${16*32},${38*32}`,`${17*32},${38*32}`,`${18*32},${38*32}`];


let rehberPath = [
{who: "rehber", type: "walk", direction: "right"},
{who: "rehber", type: "walk", direction: "right"},
{who: "rehber", type: "walk", direction: "right"},
{who: "rehber", type: "walk", direction: "right"},
{who: "rehber", type: "walk", direction: "up"},
{who: "rehber", type: "walk", direction: "up"},

{who: "diya", type: "stand", direction: "up", time:500},
{type: "textMessage", text:"Wanna join our cool competitive team?"},
{type: "textMessage", text: "If so, enter the portal and hit 'Enter'!"},

{who: "rehber", type: "walk", direction: "left"},
{who: "rehber", type: "walk", direction: "down"},
{who: "rehber", type: "walk", direction: "down"},
{who: "rehber", type: "walk", direction: "left"},
{who: "rehber", type: "walk", direction: "left"},
{who: "rehber", type: "walk", direction: "left"},
]

let rehber_cutscene_set_of_coords = [`${33*32},${63*32}`, `${34*32},${63*32}`, `${35*32},${63*32}`];


class OverworldMap {
constructor(config) {
Expand Down Expand Up @@ -195,6 +217,12 @@ class OverworldMap {
}
}

else if(rehber_cutscene_set_of_coords.includes(hero_tile)) {
for(let i = 0; i < rehber_cutscene_set_of_coords.length; i++) {
delete this.cutsceneSpaces[rehber_cutscene_set_of_coords[i]];
}
}

}

addWall(x,y) {
Expand Down Expand Up @@ -222,8 +250,8 @@ window.OverworldMaps = {
hero: new Person({
isPlayerControlled: true,
src: "./images/Hero.png",
x: utils.withGrid(15), // 15 33
y: utils.withGrid(33),
x: utils.withGrid(32), // 32 44
y: utils.withGrid(44),
}),

// myDrone: new Person({
Expand Down Expand Up @@ -374,6 +402,39 @@ window.OverworldMaps = {
]
}),

rehber: new Person({
x: utils.withGrid(30),
y: utils.withGrid(66),
src: "./images/brownGuy1.png",
behaviorLoop: [
{type: "stand", direction: "left", time: 800},
{type: "stand", direction: "up", time: 800},
{type: "stand", direction: "right", time: 1200},
{type: "stand", direction: "up", time: 300}
],
talking: [
{
events: [
{type: "textMessage", text: "It's about drive, it's about power", faceHero: "rehber"},
{type: "textMessage", text: "We stay hungry, we devour!"},
]
},
]
}),

twitterRoute1: new Person({
x: utils.withGrid(31),
y: utils.withGrid(40),
src: "./images/blankGuy.png",
talking: [
{
events: [
{type: "textMessage", text: "Redirecting to ACMVIT's Twitter!"},
{type: "redirectPerson", link: "https://twitter.com/ACM_VIT", newTab: true},
]
},
]
}),
},

walls: {
Expand Down Expand Up @@ -410,6 +471,17 @@ window.OverworldMaps = {
[utils.asGridCoord(17,38)]: [{events: diyaPath}],
[utils.asGridCoord(18,38)]: [{events: diyaPath}],

[utils.asGridCoord(33,63)]: [{events: rehberPath}],
[utils.asGridCoord(34,63)]: [{events: rehberPath}],
[utils.asGridCoord(35,38)]: [{events: rehberPath}],

// [utils.asGridCoord(31,41)]: [{events: [{type: "redirectPerson", link:'https://twitter.com/ACM_VIT', newTab:true}] }],
// [utils.asGridCoord(32,41)]: [{events: [{type: "redirectPerson", link:'https://twitter.com/ACM_VIT', newTab:true}] }],








Expand Down

0 comments on commit 60b4562

Please sign in to comment.