PetPet all tigers images and new logo

This commit is contained in:
2024-08-16 20:50:42 +02:00
parent cee37b3d61
commit ff2f9ddc29
10 changed files with 45 additions and 24 deletions

23
main.js
View File

@@ -20,7 +20,8 @@ const imgTiger = {
////Summer: {},
////Fall: {},
////Winter: {},
Dead: './img/dead/tiger.png'
Dead: './img/dead/tiger.png',
Gone: './img/gone/tiger.png'
}
let attributes = {
@@ -99,29 +100,36 @@ function display(){
Dhealth.innerHTML = toCPercen(attributes.Hp);
if(attributes.Age.value<=6){
NameC.innerHTML = `Junior`
NameC.innerHTML = `Junior`;
Aimg.src = imgTiger.Normal.tiger[0];
}else if(attributes.Age.value<18){
NameC.innerHTML = `Teen`
NameC.innerHTML = `Teen`;
Aimg.src = imgTiger.Normal.tiger[1];
}else if(attributes.Age.value<60){
NameC.innerHTML = `Adult`
NameC.innerHTML = `Adult`;
Aimg.src = imgTiger.Normal.tiger[2];
}else if(attributes.Age.value<100){
NameC.innerHTML = `Senior`
NameC.innerHTML = `Senior`;
Aimg.src = imgTiger.Normal.tiger[3];
}else{
NameC.innerHTML = `Dead`
NameC.innerHTML = `Dead`;
attributes.Life.dead = 1;
btnHide();
Aimg.src = imgTiger.Dead;
}
if(attributes.Hp.value<=0){
NameC.innerHTML = `Dead`;
attributes.Life.dead = 1;
btnHide();
Aimg.src = imgTiger.Dead;
}
if(attributes.Life.away){
NameC.innerHTML = `Gone`;
btnHide();
Aimg.src = imgTiger.Gone;
}
}
function play(){
@@ -173,10 +181,9 @@ function btnHide(){
}
function sadDetection(){
if(attributes.Joy.value <= attributes.Joy.abszero){
if((attributes.Joy.value <= attributes.Joy.abszero)&&(attributes.Joy.value<0)){
if(Math.abs(attributes.Joy.value) >= Math.floor(Math.random()*100)){
attributes.Life.away = 1;
btnHide();
}
}
}