xPipeZ Posted September 13, 2020 Share Posted September 13, 2020 Hello everyone, I am currently developing a small radar for racing but I ran into a small problem that I have not been able to solve When I'm drawing the blips on the radar for the race checkpoints, it literally draws all of them and not just the first two, which are the ones that are visible to the player Here is my part of the code where I am doing this, thanks in advance for i, checkpoint in ipairs(getElementsByType("checkpoint")) do local cpx = getElementData(checkpoint, "posX"); local cpy = getElementData(checkpoint, "posY"); local dist = getDistanceBetweenPoints2D(px, py, cpx, cpy); if dist > range then dist = range; end local angle = 180 - north + findRotation(px, py, cpx, cpy); local cbx, cby = getPointFromDistanceRotation(0, 0, size * (dist / range) / 2, angle); local bx = centerLeft + cbx - blipSize/2; local by = centerTop + cby - blipSize/2; local yoff = 0; local r, g, b, a = getColorFromString(getElementData(checkpoint, "color")); local img = "assets/images/checkpoint.png"; dxDrawImage(bx, by, blipSize, blipSize, img, 0, 0, 0, tocolor(r, g, b, a)); end Link to comment
Tekken Posted September 13, 2020 Share Posted September 13, 2020 if i <= 2 than not sure is that you need but you may try Link to comment
xPipeZ Posted September 13, 2020 Author Share Posted September 13, 2020 Nope, this will only draw first two checkpoints, thans for answering anyway! Link to comment
Tekken Posted September 14, 2020 Share Posted September 14, 2020 Well isn’t that that you want? Link to comment
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