- Mar 28, 2021
- 5
- 1
Hello I am trying to create a action whe you pick up an item but I dont understan why it creates a couple of items every time the cursor pass over any hovered icon. I dont know why.
If somebody has any idea of how solving o changing in order to abord this, please I will be very greatfull. thanks!
If somebody has any idea of how solving o changing in order to abord this, please I will be very greatfull. thanks!
Python:
init offset = -1
python:
bpant = item("Bragas negras", imagen="icons/obj/pantMaga.png", description= "i.", cost=0)
brandy = item("Brandy", imagen="icons/obj/brandy.png", description= "a"=0)
screen Mapa():
imagemap:
auto "fondos/Aldea_%s.png"
hotspot (1519, 181, 302, 199) action Jump("Casa")
hotspot (974, 123, 501, 434) action Jump("Guild")
hotspot (669, 390, 176, 102) action Jump("Barn")
hotspot (154, 324, 244, 192) action Jump("WitchH")
hotspot (192, 536, 224, 261) action Jump("WIP")
hotspot (1677, 687, 180, 90) action Jump("WIP")
fixed:
if hasMgpants == False:
vbox:
xpos 500
ypos 500
imagebutton auto "pants_%s.png" action [SetVariable("hasMgpants", True), inventory.add(bpant)] #this is what I think its causing the problem
hbox:
imagebutton auto "icons/Map_ico_%s.png" action Jump("Mapa")
imagebutton auto "icons/Moc_ico_%s.png" action Show("Mochila")
screen Mochila:
add "fondos/Inventario.png"
modal True
default itn = Tooltip (" ")
default itd = Tooltip (" ")
vbox:
imagebutton auto "icons/BackArrow_%s.png" action Hide("Mochila")
vbox:
xalign 0.15
yalign 0.5
frame:
textbutton _("[money]"):
hovered [itn.Action("Money"), itd.Action("Current amount of money")]
action NullAction()
hbox :
grid 5 4:
# spacing 10
xpos 810
ypos 180
for item in inventory.items:
imagebutton:
idle item.imagen
xpos 20
ypos 5
hovered [itn.Action(item.name), itd.Action(item.description)]
action NullAction()
for i in range( len( inventory.items ), 20 ):
add "icons/obj/empty.png"
frame:
xysize (450, 40)
xalign 0.04
ypos 700
text " " + itn.value + " "
frame:
xysize (450, 200)
xalign 0.04
ypos 750
text itd.value + " "
label start:
$ inventory = Inventory()
$ money = 10
jump Mapa
label Mapa:
call screen Mapa