Jump to a question:
In the code editor, write:
function _init()
text = "Hello World"
x = 20
y = 20
color = 10
end
function _draw()
log("Hello World", x,y,color)
end
This should print "Hello World" to the screen when you hit run.
Another great way to get started is to import an existing project from the explorer- these are little demos to show how it all works. If you make a cool project, send it to me and I'll upload it for everyone to see!
Yeah you probably have a bug.
You can debug in Handsome Console really easily by using hlog("Some text")
If hlog, doesn't print anything, your bug is somewhere before hlog gets called! Just put a few of them in your code and see which ones get called and you should be able to see your error pretty quickly.
Handsome Console is admittedly a little unforgiving when it comes to typos, if enough people express interest in the project I'll put in a syntax checker!
Email me if anything sucks to use, I will fix it but I can't fix it if I don't know there's a problem! Don't be shy, I'm friendly and love user feedback.
You need to implement the _update() callback. The standard for down, up, left, right is this:
function _init()
x = 0
y = 0
color = 1
end
function _update()
-- down
if (btn_d) then
y = y + 1
end
-- up
if (btn_u) then
y = y - 1
end
-- left
if (btn_l) then
x = x - 1
end
-- down
if (btn_r) then
x = x + 1
end
-- "A" button
if (btn_a) then
hlog("A pressed yo")
color = color + 1
end
-- "B" button
if (btn_b) then
hlog("B pressed yo")
color = color - 1
end
end
function _draw()
-- Clear screen first!
cls()
-- Fill a 10x10 square with top left corner
-- at position (x,y) using the color variable
-- as the color
rectfill(x, y ,x + 10 y + 10, color)
end
You caught me, I'm actually an idiot and don't know how to implement that using the Lua Virtual Machine I'm using (Kahlua2 by Krka, awesome job mate, couldn't have done it without you https://github.com/krka/kahlua2)
Just use y = y + 1 and y = y - 1 like a caveman okay?