just before (in other words RIGHT ABOVE) the 'end' for each of your 'if' loops. put a "screen.waitVblankStart(5 )".Zitat:
Zitat von PSPduh
put a small number in the parantheses, whichever you want. that should slow things down to how you want.
Printable View
just before (in other words RIGHT ABOVE) the 'end' for each of your 'if' loops. put a "screen.waitVblankStart(5 )".Zitat:
Zitat von PSPduh
put a small number in the parantheses, whichever you want. that should slow things down to how you want.
so it would look like this:
Code:if pad:up() then
r = r + 1
screen.waitVblankStart(5)
end
if pad:down() then
r = r + 5
screen.waitVblankStart(5)
end
if pad:right() then
r = r + 20
screen.waitVblankStart(5)
end
if pad:left() then
r = r + 10
screen.waitVblankStart(5)
end
SO MUCH THANKS! And also, another problem. (I never stop having problems) This should be the last one. In my code I have:
Yet as r increases, d stays the same. If i set r as 1, d would show up as d = 2, and never go up no matter how much r goes up. THis is the final problem, (I hope!)Code:r = 0
d = r*2
function caf()
x = r*r*3.14
end
function cac()
y = d*3.14
end
THANKS again.
can you post all the code again, i need to see it all in one place as it is. (its confusing going back and forth between posts to see where we are)Zitat:
Zitat von PSPduh
Whoops, here is the whole code:
Now you can kinda see what I am trying to make.Code:red = Color.new(255,0,0)
yellow = Color.new(255, 255, 0)
blue = Color.new(0, 0, 255)
orange = Color.new(223, 88, 6)
grey = Color.new(94, 97, 111)
black = Color.new(0, 0, 0)
white = Color.new(255, 255, 255)
green = Color.new(0,255,0)
r = 0
d = r*2
function caf()
x = r*r*3.14
end
function cac()
y = d*3.14
end
while true do
screen:clear(green)
pad = Controls.read()
if pad:up() then
r = r + 1
screen.waitVblankStart(7)
end
if pad:down() then
r = r + 5
screen.waitVblankStart(7)
end
if pad:right() then
r = r + 20
screen.waitVblankStart(7)
end
if pad:left() then
r = r + 10
screen.waitVblankStart(7)
end
if r > 500 then
r = 0
end
if pad:cross() then
caf()
screen:print(100, 100, 'Circles area = ' .. x, black)
end
if pad:square() then
cac()
screen:print(10,10,'Circles circumfence = ' .. y, black)
end
screen:print(10,20,"Diameter = " .. d, black)
screen:print(10,10,"Radius = " .. r, black)
oldpad = pad
screen.waitVblankStart()
screen.flip()
end
do the circle's diameter and circumference show correctly? (i cant find my PSP's usb wire so i cant test it)Zitat:
Zitat von PSPduh
Yeah, both of them show correctly. It's just that I would like them to d to increase as r is. It would make the app much simpler.
I really dont know..all the coding looks fine. dont know why it doesnt work.
Meh, then thanks anyway. I could work around that...Do you know how to code menus? Because if you do, then just PM me, because I could use you for this app.
JW, In LUA is it possible to find out the PSP Username?