Can a sword have different variants? For example, variant 2 for a red sword graphic?
Code ( lua) Select
game:set_ability("sword", 2)
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: Christopho on January 19, 2017, 02:24:28 PM
Here is the exact list of filenames currently hardcoded in the engine: https://github.com/solarus-games/solarus/blob/dev/work/data_files.txt
local test = {}
local testing
test[0] = "test1"
test[1] = "test2"
test[2] = "test3"
test[3] = "test4"
test[4] = "test5"
test[5] = "test6"
test[6] = "test7"
test[7] = "test8"
for i = 0,7 do
show_test[rep] = sol.text_surface.create({
text = test[i],
})
end
function sol.main:on_draw(screen)
--clear and overwrite
test = {}
if testing == true then
test[0] = "test_overwrite1"
test[1] = "test_overwrite2"
test[2] = "test_overwrite3"
test[3] = "test_overwrite4"
test[4] = "test_overwrite5"
test[5] = "test_overwrite6"
test[6] = "test_overwrite7"
test[7] = "test_overwrite8"
end
for i = 0,7 do
show_text[i]:draw(screen,x_test_pos,y_test_pos[i])
end
end
end
Quotefile:write("Hello World")Can I write the value of a variable?
local coordinate_x = 50
local coordinate_y = 40
file:write("x:",coordinate_x, "y:", coordinate_y)
Quote from: MetalZelda on November 10, 2016, 12:54:30 PM
You can do shorter
for i = 1, whatever_you_want do
if i < 15 then
-- calculation
elseif i < 30 then
-- other calculation
elseif i < 45
-- Again
end
end
for rep = 1, 15 do
--blah different coordinate calculations
for rep = 15, 30 do
--blah different different coordinates calculations
for rep = 30,45 do
--blah different coordinates calculations
for rep = etc....... do
--blah different coordinates calculations
end
end
end
end
for 1,15 do
local starter={}
local ender ={}
for rep 1,15 do
starter[rep] = 0
ender[rep] = 0
end
for reprep = 1,15 do
starter[reprep]=starter[reprep] +15
ending[reprep] = starter[reprep] +15
for rep = starter[reprep], ending[reprep] do
--blah different coordinates calculations arrays
end
end