Skip to content

Commit

Permalink
Adding doors and texts
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoAverty committed May 21, 2024
1 parent 2f2c8a6 commit 238326f
Show file tree
Hide file tree
Showing 6 changed files with 4,611 additions and 670 deletions.
27 changes: 13 additions & 14 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,25 @@ import { bootstrapExtra } from "@workadventure/scripting-api-extra";

console.log('Script started successfully');

let currentPopup: any = undefined;

// Waiting for the API to be ready
WA.onInit().then(() => {
console.log('Scripting API ready');
console.log('Player tags: ',WA.player.tags)

WA.room.area.onEnter('clock').subscribe(() => {
const today = new Date();
const time = today.getHours() + ":" + today.getMinutes();
currentPopup = WA.ui.openPopup("clockPopup", "It's " + time, []);
})
WA.room.onEnterLayer("roofZone1").subscribe(() => {
WA.room.hideLayer("Roof1");
});
WA.room.onLeaveLayer("roofZone1").subscribe(() => {
WA.room.showLayer("Roof1");
});


WA.room.area.onLeave('clock').subscribe(closePopup)
WA.room.onEnterLayer("roofZone2").subscribe(() => {
WA.room.hideLayer("Roof2");
});
WA.room.onLeaveLayer("roofZone2").subscribe(() => {
WA.room.showLayer("Roof2");
});

// The line below bootstraps the Scripting API Extra library that adds a number of advanced properties/features to WorkAdventure
bootstrapExtra().then(() => {
Expand All @@ -26,11 +31,5 @@ WA.onInit().then(() => {

}).catch(e => console.error(e));

function closePopup(){
if (currentPopup !== undefined) {
currentPopup.close();
currentPopup = undefined;
}
}

export {};
Binary file added tilesets/Custom.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 tilesets/Custom.psd
Binary file not shown.
Binary file modified tilesets/Flat_Office.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 modified tilesets/Flat_Office.psd
Binary file not shown.
Loading

0 comments on commit 238326f

Please sign in to comment.