Well the building is an object, right? So you would put the code in the mouse click event within the building object:
if (y < height_of_popup) { //make menu lower } else { //make menu normal height }
duh, I need to use my head. Thanks!
Not Telling
Vilvake hasn't added any friends yet.
14 April 2012 - 04:53 AM
Well the building is an object, right? So you would put the code in the mouse click event within the building object:
if (y < height_of_popup) { //make menu lower } else { //make menu normal height }
14 April 2012 - 04:48 AM
if (the buildings y value) < (height of popup menu){
whatever
}
13 April 2012 - 09:11 PM
How about trying to use else if instead of a new block of if statement?
That seems to work for all buildings except my castle. I have tried coding it a hundred different ways, but I can't find my mistake! It either will go to level 2 or 3, seemingly randomly.
click event for obj_upgradeswitch(global.castlelvl){ case 1: if global.wood >= 500{ global.wood -= 500; global.castlelvl = 2; global.buildslots += 5; break; } case 2: if global.wood >= 1000{ if global.stone >= 1500{ global.wood -= 1000; global.stone -=1500; global.castlelvl = 3; global.buildslots += 5; break; } } case 3: if global.wood >=4500{ if global.stone >= 5000{ global.wood -= 4500 global.stone -= 5000; global.castlelvl = 4; global.buildslots += 5; break; } } case 4: if global.wood >= 9500{ if global.stone >= 10000{ global.wood -= 9500 global.stone -= 10000; global.castlelvl = 5; global.buildslots += 5; break; } } else { break } }
Try coding it like this:
Try using the "and" statement .. I notice how in case one the expression is if global.wood is greater than or equal to 5000 which also means it is a case 2 .. Make it so that it says if global.wood is greater than or equal to 5000 AND less than 10000.
13 April 2012 - 06:37 PM
How about trying to use else if instead of a new block of if statement?
switch(global.castlelvl){
case 1:
if global.wood >= 500{
global.wood -= 500;
global.castlelvl = 2;
global.buildslots += 5;
break;
}
case 2:
if global.wood >= 1000{
if global.stone >= 1500{
global.wood -= 1000;
global.stone -=1500;
global.castlelvl = 3;
global.buildslots += 5;
break;
}
}
case 3:
if global.wood >=4500{
if global.stone >= 5000{
global.wood -= 4500
global.stone -= 5000;
global.castlelvl = 4;
global.buildslots += 5;
break;
}
}
case 4:
if global.wood >= 9500{
if global.stone >= 10000{
global.wood -= 9500
global.stone -= 10000;
global.castlelvl = 5;
global.buildslots += 5;
break;
}
}
else
{
break
}
}
12 April 2012 - 04:40 PM
if global.wood >= 100{
with global.lastclicked{
if lvl = 1{
lvl += 1;
global.wood -= 100;
}
}
}
if global.wood >= 200{
with global.lastclicked{
if lvl = 2{
lvl += 1;
global.wood -= 200;
}
}
}
if global.wood >= 300{
with global.lastclicked{
if lvl = 3{
lvl += 1;
global.wood -= 300;
}
}
}
Community Forum Software by IP.Board
Licensed to: YoYo Games Ltd

Find content