GTX Posted August 3, 2015 Posted August 3, 2015 viewforum.php?f=148 Here are many tutorials you can learn from. Some topics include video. Explore Here's one: viewtopic.php?f=148&t=75501&p=701393#p701393
franku Posted August 3, 2015 Author Posted August 3, 2015 (edited) Solved Edited August 10, 2016 by Guest
franku Posted August 3, 2015 Author Posted August 3, 2015 (edited) Aplved Edited August 10, 2016 by Guest
franku Posted August 3, 2015 Author Posted August 3, 2015 (edited) Solved Edited August 10, 2016 by Guest
GTX Posted August 3, 2015 Posted August 3, 2015 You can use 'for' loop to draw multiple rectangle based on their position and index from loop. http://www.lua.org/pil/4.3.4.html Example: for i=1, 12 do dxDrawRectangle(500, 100+(i*50), 50, 30, tocolor(0, 0, 0, 255)) end
franku Posted August 3, 2015 Author Posted August 3, 2015 (edited) Solved Edited August 10, 2016 by Guest
franku Posted August 3, 2015 Author Posted August 3, 2015 (edited) Solved Edited August 10, 2016 by Guest
franku Posted August 3, 2015 Author Posted August 3, 2015 (edited) Solved Edited August 10, 2016 by Guest
GTX Posted August 3, 2015 Posted August 3, 2015 DX functions return only boolean value. That means it's true (if created successfully) or false (otherwise). That is a bit harder. You'll have to calculate their intersections. Like this (based on my example): addEventHandler("onClientClick", root, function(button, state, x, y) if button == "left" and state == "down" then for i=1, 12 do if x >= 500 and x <= 500+50 and y >= 100+(i*50) and y <= 100+(i*50)+30 then outputChatBox("Pressed on rectangle number "..i) end end end end )
franku Posted August 3, 2015 Author Posted August 3, 2015 (edited) Solved Edited August 10, 2016 by Guest
GTX Posted August 3, 2015 Posted August 3, 2015 ipairs/pairs is used when you're looping through a table. We are using so-called numeric for which loops through specific chunk and returns current processed number based on what numbers you expressed as values in for loop.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now