will result in the same as a screen:drawLine(0, 0, 100, 50, red)
my question, how do you make it so that the line goes in the right place?
ie to the edge of the screen as though it would end at -10, -10. im new to lua and building off of the paint tutorial :). if you need to see my code i can post it for you :)
screen:drawLine(-10, -10, 100, 50, red) ie off screen
Moderators: Shine, Insert_witty_name
-
- Posts: 17
- Joined: Mon Oct 03, 2005 5:00 am
Well an easy way is to use absolute value to shorten the width and offset the x.. for example..
Pseudo Code:
This also works when you are blitting outside of the screen. I REALLY don't recommend ever using negative values when drawing anything in Lua because sometimes it might work but not all the time. I noticed that in my game, so offset like I showed above:)
Pseudo Code:
Code: Select all
x1=-20
offsetx=0
if (x1<0) then
offsetx=math.abs(x1)
end
-- do the same thing for Y
screen:drawline(x1+offsetx,y1+offsety,x2-offsetx,y2-offsetx,red)
-
- Posts: 17
- Joined: Mon Oct 03, 2005 5:00 am
hmm i see where you are coming from, but that seems like a lot of hassle, especially if i have much larger models being drawn etc.
take a look at this
http://host-a.net/getfile.php?usern=mon ... e=ship.zip (left click)
move the ship off to the side and you will see what im talking about. controls are x fire ^ change arc and l + r aim. anyone who can help me will be hailed as a god in the credits of this game :D
dont comment on the state of my code.... :P
take a look at this
http://host-a.net/getfile.php?usern=mon ... e=ship.zip (left click)
move the ship off to the side and you will see what im talking about. controls are x fire ^ change arc and l + r aim. anyone who can help me will be hailed as a god in the credits of this game :D
dont comment on the state of my code.... :P
Currently there is no real clipping implemented, just a if (x<0) x=0 and the like, so it might looks strange, if you are using coordinates which are not on-screen or on-image. I've added it to the TODO list at http://wiki.ps2dev.org/psp:lua_player:todos
-
- Posts: 17
- Joined: Mon Oct 03, 2005 5:00 am