my game work perfect in editor or project-> build html5 but when export my game to html5, the game does not work properly, I have maybe problems with msg.post or “acquire_input_focus”, is possible?
Could you be a bit more specific? In what way does it not work? Do you get any message in the browser console?
I found the error, I need help.
I have 3 game object, enemie0, enemie1, enemie2, I need put each enemie in a table and get a property called n_enemie in the script “#script1”
How does the n_enemie relate to the table with enemie0, enemie1, enemie2? Is it the number of enemies? How is it supposed to be used? Will there always be three values in the table or can it change over time? You are not providing enough information for me to give a good answer. I’m guessing a bit:
local t = { "enemie0", "enemie1", "enemie2" }
--script1.script
go.property("n_enemie", 1234)
--foobar.script
local n_enemie = go.get("#script1", "n_enemie")
for each level I have enemies in my level collection, each enemie have a property “n_enemie” so, if fire enemie1 now enemie2 fire, if enemie 2 fire but enemie3 is killed fire enemie1.
I have a collection enemie and in my levels I have enemie1/enemie, enemie2/enemie and enemie3/enemie but maybe in level 2 I have two enemies, enemie1/enemie, enemie2/enemie, so I need save each enemie in a table to compare in gamemanager script what enemie fire, when a enemie is killed I remove it from table
sorry for my english, now is working very good I save each enemie:
self.name = "enemie" .. tostring(self.n_enemie - 1) .. "/enemie"
msg.post("/gamemanager#script","add_enemie", {id = self.name, pos = self.n_enemie})
and in game manager, I find my next enemie turn
msg.post("/player/player","turn_off")
addCount(self)
self.enemie = -1;
while self.enemie == -1 do
--html5.run("console.log('fu3')")
for i=1, #self.enemies do
if go.get(self.enemies[i] .. "#script","n_enemie") == self.enemie_fire then
self.enemie = i
break
end
end
if self.enemie == -1 then
addCount(self)
end
end
local id = self.enemies[self.enemie] .. "#script1"
msg.post(id,"fire")