Zeige Ergebnis 7.831 bis 7.860 von 10238
Lua Programming Help Thread
This is a discussion on Lua Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; * continues to have example ignored *...
-
07-30-2007, 04:16 PM #7831words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
* continues to have example ignored *

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
07-30-2007, 05:22 PM #7832
This is my main question code so far.
System.usbDiskModeActivat e()
question1 = "What is the common name of the disease that plagued medieval Europe?"
answer1a = "Black Death"
answer1b = "Bubonic Death"
answer1c = "White Death"
answer1d = "Dark Plague"
question2 = "How long did the Hundred Years' War last?"
answer2a = "100 Years"
answer2b = "116 Years"
answer2c = "123 Years"
answer2d = "98 Years"
question3 = "How was the Bubonic Plague spread throughout medieval Europe?"
answer3a = "Ticks"
answer3b = "Fleas"
answer3c = "Rats"
answer3d = "Beavers"
question4 = "what object were Vikings buried in?"
answer4a = "Crypts"
answer4b = "Graves"
answer4c = "Coffins"
answer4d = "Their Ships"
question5 = "What was another name for Vikings?"
answer5a = "Plunderers"
answer5b = "Wolfmen"
answer5c = "Norsemen"
answer5d = "They didn't have another name"
question6 = "What countries did Vikings originate from?"
answer6a = "Denmark, Sweden and Norway"
answer6b = "Greenland, Iceland and Switzeland"
answer6c = "Icelad, Germany, Norway"
answer6d = "Denmark, Switzeland and Norway"
question7 = "Knights fought on what?"
answer7a = "Horses"
answer7b = "Cows"
answer7c = "Slaves"
answer7d = "They fought on their own feet"
question8 = "What 4 empires existed before the dark ages?"
answer8a = "Chinese, Persian, Roman and American"
answer8b = "Chinese, Japanese, Roman and British"
answer8c = "Japanese, Britsh, Roman and Guptan"
answer8d = "Chinese, Persian, Guptan and Roman"
question9 = "How did the Roman's use the term barbarian"
answer9a = "To describe invaders"
answer9b = "To describe the strongest of their warriors"
answer9c = "To describe foreigners"
answer9d = "To describe warriors who had killed more than 100 people"
question10 = "Why did Vikings originally travel overseas?"
answer10a = "To steal people for slavery"
answer10b = "To trade and barter"
answer10c = "To steal food and animals"
answer10d = "To explore"
question11 = "What of the following were weapons used by vikings?"
answer11a = "Double-Axe, Spear and Sword"
answer11b = "Bows, Guns and Swords"
answer11c = "Cannons, Rifles and Daggers"
answer11d = "Daggers, Swords and rifles"
pink = Color.new(255, 0 , 153)
blue = Color.new(0 , 0, 255)
orange = Color.new(255, 102, 0)
gray = Color.new(153, 153, 153)
black = Color.new(0 , 0 , 0)
red = Color.new(255,0,0)
green = Color.new(0,255,0)
white = Color.new(255,255,255)
oldpad = Controls.read()
function printCentred(y,text,color )
local length = string.len(text)
local x = 240 - ((length*8)/2)
screen
rint(x,y,text,color)
end
RanNumber = 0 -
math.randomseed(os.time() )
RanNumber = math.random(1,11)
gametimer=Timer.new()
time=120
gametimer:start()
while true do
pad = Controls.read()
gamestime=gametimer:time( )
screen:clear()
if time == 0 then
dofile("./sets.lua")
end
if gamestime > 1000 then time = time - 1 gametimer:reset(0) gametimer:start()
end
--Question Statement Starts Here
if RanNumber == 1 then
screen:blit(0,0,backgroun d,false)
screen
rint(0,0,time,white)
printCentred(0,"Question Number Is: "..RanNumber,green)
printCentred(156,question 1,green)
printCentred(166,answer1a ,green)
printCentred(176,answer1b ,green)
printCentred(186,answer1c ,green)
printCentred(196,answer1d ,green)
screen.flip()
if pad:up() and oldpad:up() ~= pad:up() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Correct ",green)
screen.flip()
screen.waitVblankStart(60 )
end
end
if pad:down() and oldpad:down() ~= pad:down() or pad:left() and oldpad:left() ~= pad:left() or pad:right() and oldpad:right() ~= pad:right() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Incorre ct",green)
screen.flip()
screen.waitVblankStart(60 )
end
--Question Statement Ends Here
--Question Statement Starts Here
if RanNumber == 2 then
screen:blit(0,0,backgroun d,false)
screen
rint(0,0,time,white)
printCentred(0,"Question Number Is: "..RanNumber,green)
printCentred(156,question 2,green)
printCentred(166,answer2a ,green)
printCentred(176,answer2b ,green)
printCentred(186,answer2c ,green)
printCentred(196,answer2d ,green)
screen.flip()
if pad:left() and oldpad:left() ~= pad:left() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Correct ",green)
screen.flip()
screen.waitVblankStart(20 )
end
end
if pad:down() and oldpad:down() ~= pad:down() or pad:up() and oldpad:up() ~= pad:up() or pad:right() and oldpad:right() ~= pad:right() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Incorre ct",green)
screen.flip()
screen.waitVblankStart(60 )
end
--Question Statement Ends Here
--Question Statement Starts Here
if RanNumber == 3 then
screen:blit(0,0,backgroun d,false)
screen
rint(0,0,time,white)
printCentred(0,"Question Number Is: "..RanNumber,green)
printCentred(156,question 3,green)
printCentred(166,answer3a ,green)
printCentred(176,answer3b ,green)
printCentred(186,answer3c ,green)
printCentred(196,answer3d ,green)
screen.flip()
if pad:up() and oldpad:up() ~= pad:up() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Correct ",green)
screen.flip()
screen.waitVblankStart(60 )
end
end
if pad:down() and oldpad:down() ~= pad:down() or pad:left() and oldpad:left() ~= pad:left() or pad:right() and oldpad:right() ~= pad:right() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Incorre ct",green)
screen.flip()
screen.waitVblankStart(60 )
end
--Question Statement Ends Here
--Question Statement Starts Here
if RanNumber == 4 then
screen:blit(0,0,backgroun d,false)
screen
rint(0,0,time,white)
printCentred(0,"Question Number Is: "..RanNumber,green)
printCentred(156,question 4,green)
printCentred(166,answer4a ,green)
printCentred(176,answer4b ,green)
printCentred(186,answer4c ,green)
printCentred(196,answer4d ,green)
screen.flip()
if pad:down() and oldpad:down() ~= pad:down() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Correct ",green)
screen.flip()
screen.waitVblankStart(60 )
end
end
if pad:up() and oldpad:up() ~= pad:up() or pad:left() and oldpad:left() ~= pad:left() or pad:right() and oldpad:right() ~= pad:right() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Incorre ct",green)
screen.flip()
screen.waitVblankStart(60 )
end
--Question Statement Ends Here
--Question Statement Starts Here
if RanNumber == 5 then
screen:blit(0,0,backgroun d,false)
screen
rint(0,0,time,white)
printCentred(0,"Question Number Is: "..RanNumber,green)
printCentred(156,question 5,green)
printCentred(166,answer5a ,green)
printCentred(176,answer5b ,green)
printCentred(186,answer5c ,green)
printCentred(196,answer5d ,green)
screen.flip()
if pad:right() and oldpad:right() ~= pad:right() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Correct ",green)
screen.flip()
screen.waitVblankStart(60 )
end
end
if pad:down() and oldpad:down() ~= pad:down() or pad:left() and oldpad:left() ~= pad:left() or pad:up() and oldpad:up() ~= pad:up() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Incorre ct",green)
screen.flip()
screen.waitVblankStart(60 )
end
--Question Statement Ends Here
--Question Statement Starts Here
if RanNumber == 6 then
screen:blit(0,0,backgroun d,false)
screen
rint(0,0,time,white)
printCentred(0,"Question Number Is: "..RanNumber,green)
printCentred(156,question 6,green)
printCentred(166,answer6a ,green)
printCentred(176,answer6b ,green)
printCentred(186,answer6c ,green)
printCentred(196,answer6d ,green)
screen.flip()
if pad:up() and oldpad:up() ~= pad:up() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Correct ",green)
screen.flip()
screen.waitVblankStart(60 )
end
end
if pad:down() and oldpad:down() ~= pad:down() or pad:left() and oldpad:left() ~= pad:left() or pad:right() and oldpad:right() ~= pad:right() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Incorre ct",green)
screen.flip()
screen.waitVblankStart(60 )
end
--Question Statement Ends Here
--Question Statement Starts Here
if RanNumber == 7 then
screen:blit(0,0,backgroun d,false)
screen
rint(0,0,time,white)
printCentred(0,"Question Number Is: "..RanNumber,green)
printCentred(156,question 1,green)
printCentred(166,answer7a ,green)
printCentred(176,answer7b ,green)
printCentred(186,answer7c ,green)
printCentred(196,answer7d ,green)
screen.flip()
if pad:up() and oldpad:up() ~= pad:up() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Correct ",green)
screen.flip()
screen.waitVblankStart(60 )
end
end
if pad:down() and oldpad:down() ~= pad:down() or pad:left() and oldpad:left() ~= pad:left() or pad:right() and oldpad:right() ~= pad:right() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Incorre ct",green)
screen.flip()
screen.waitVblankStart(60 )
end
--Question Statement Ends Here
--Question Statement Starts Here
if RanNumber == 8 then
screen:blit(0,0,backgroun d,false)
screen
rint(0,0,time,white)
printCentred(0,"Question Number Is: "..RanNumber,green)
printCentred(156,question 8,green)
printCentred(166,answer8a ,green)
printCentred(176,answer8b ,green)
printCentred(186,answer8c ,green)
printCentred(196,answer8d ,green)
screen.flip()
if pad:down() and oldpad:down() ~= pad:down() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Correct ",green)
screen.flip()
screen.waitVblankStart(60 )
end
end
if pad:up() and oldpad:up() ~= pad:up() or pad:left() and oldpad:left() ~= pad:left() or pad:right() and oldpad:right() ~= pad:right() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Incorre ct",green)
screen.flip()
screen.waitVblankStart(60 )
end
--Question Statement Ends Here
--Question Statement Starts Here
if RanNumber == 9 then
screen:blit(0,0,backgroun d,false)
screen
rint(0,0,time,white)
printCentred(0,"Question Number Is: "..RanNumber,green)
printCentred(156,question 9,green)
printCentred(166,answer9a ,green)
printCentred(176,answer9b ,green)
printCentred(186,answer9c ,green)
printCentred(196,answer9d ,green)
screen.flip()
if pad:right() and oldpad:right() ~= pad:right() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Correct ",green)
screen.flip()
screen.waitVblankStart(60 )
end
end
if pad:down() and oldpad:down() ~= pad:down() or pad:left() and oldpad:left() ~= pad:left() or pad:up() and oldpad:up() ~= pad:up() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Incorre ct",green)
screen.flip()
screen.waitVblankStart(60 )
end
--Question Statement Ends Here
--Question Statement Starts Here
if RanNumber == 10 then
screen:blit(0,0,backgroun d,false)
screen
rint(0,0,time,white)
printCentred(0,"Question Number Is: "..RanNumber,green)
printCentred(156,question 10,green)
printCentred(166,answer10 a,green)
printCentred(176,answer10 b,green)
printCentred(186,answer10 c,green)
printCentred(196,answer10 d,green)
screen.flip()
if pad:left() and oldpad:left() ~= pad:left() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Correct ",green)
screen.flip()
screen.waitVblankStart(60 )
end
end
if pad:down() and oldpad:down() ~= pad:down() or pad:up() and oldpad:up() ~= pad:up() or pad:right() and oldpad:right() ~= pad:right() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Incorre ct",green)
screen.flip()
screen.waitVblankStart(60 )
end
--Question Statement Ends Here
--Question Statement Starts Here
if RanNumber == 11 then
screen:blit(0,0,backgroun d,false)
screen
rint(0,0,time,white)
printCentred(0,"Question Number Is: "..RanNumber,green)
printCentred(156,question 11,green)
printCentred(166,answer11 a,green)
printCentred(176,answer11 b,green)
printCentred(186,answer11 c,green)
printCentred(196,answer11 d,green)
screen.flip()
if pad:up() and oldpad:up() ~= pad:up() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Correct ",green)
screen.flip()
screen.waitVblankStart(60 )
end
end
if pad:down() and oldpad:down() ~= pad:down() or pad:left() and oldpad:left() ~= pad:left() or pad:right() and oldpad:right() ~= pad:right() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Incorre ct",green)
screen.flip()
screen.waitVblankStart(60 )
end
--Question Statement Ends Here
screen.waitVblankStart()
oldpad = pad
end
-
07-30-2007, 05:49 PM #7833words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
eww... God invented arrays and structures for a reason ;)
Look at my version for what I mean.
...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
07-30-2007, 06:05 PM #7834QJ Gamer Bronze
- Registriert seit
- Mar 2007
- Beiträge
- 758
- Points
- 8.665
- Level
- 62
- Downloads
- 0
- Uploads
- 0
don't forget about code tags...
that much text in a wall like that is enough to scare little kids like me
-
07-30-2007, 07:46 PM #7835
yeah that is very scary. arrays would make it dynamic as well as easy to change and fix.
-
07-30-2007, 08:07 PM #7836lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Dude, At least put it in code tags. Also, The code structure is horrible, Its hard to read it. >.<
Zitat von drag_93
-
07-30-2007, 08:53 PM #7837QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
seriously learn how to use an array it well make life so much easier
anyways heres your prob:
it's not choosing a new number because:
if pad:left() and oldpad:left() ~= pad:left() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Correct ",green)
screen.flip()
screen.waitVblankStart(60 )
end
when the answer is correct you don't call the RanNumber again so do:
if pad:left() and oldpad:left() ~= pad:left() then
screen:clear()
screen:blit(0,0,backgroun d,false)
printCentred(156,"Correct ",green)
screen.flip()
screen.waitVblankStart(60 )
RanNumber = math.random(1,11)
end
that well fix it however highly surgest you re-write it and use an array instead well be so much better to A incorporate new questions and B make your code so much clearer1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
07-30-2007, 09:10 PM #7838QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
what guys? it doesnt look so ba-*scrolls post* AAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAA!!!!!!! *dies of heart stress*

LOL
i could finish a potter book before that! wow!
funny thing is, i remember when i posted something like this up and had youresam losing his mind. :ROFL: i believe i made interchangeable menus with different colors for text.. the very long way like this guy did here, good news is (knowing that): there is hope for this fellow too. :)[CENTER][IMG]http://img148.imageshack.us/img148/6985/siglw8.jpg[/IMG][/CENTER]
-
07-30-2007, 11:02 PM #7839QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
Thanks people, I got my diagonal rectangle working.
If anyone cares:
Code:function GuRectangle(x,y,width,height,angle,colour) local halfWidth = width/2 local halfHeight = height/2 triangles = { {colour,-1*halfWidth,-1*halfHeight,0}, {colour,-1*halfWidth,1*halfHeight,0}, {colour,1*halfWidth,-1*halfHeight,0}, {colour,-1*halfWidth,1*halfHeight,0}, {colour,1*halfWidth,1*halfHeight,0}, {colour,1*halfWidth,-1*halfHeight,0} } Gum.matrixMode(Gu.MODEL) Gum.loadIdentity() Gum.translate(x, y, -290); Gu.disable(Gu.TEXTURE_2D) Gum.rotateXYZ(0, 0, angle * (math.pi/180)) Gum.drawArray(Gu.TRIANGLES, Gu.COLOR_8888+Gu.VERTEX_32BITF+Gu.TRANSFORM_3D, triangles) end
-
07-30-2007, 11:06 PM #7840lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Thanks for the snippet!
-
07-31-2007, 08:01 AM #7841
does anyone know how the paint bucket tool works? i could easily create a tool that fills a pixel, then checks its neighbors, and for each neighbor, repeat. but that would be extremely slow and memory consuming. it was done in yPaint by yongobongo, but he locked the script.
-
07-31-2007, 10:23 AM #7842QJ Gamer Blue
- Registriert seit
- Jul 2007
- Ort
- Bavaria!
- Beiträge
- 162
- Points
- 4.021
- Level
- 40
- Downloads
- 0
- Uploads
- 0
Hi guys, there is something that i havent understood yet...
what does that mean: analogX/Y -ranges from -127 to 128
what does that mean? I dont understand it? Why does it actually range from -127 to 128? Whats that good for? I need to understand...
-
07-31-2007, 10:35 AM #7843Developer

- Registriert seit
- Oct 2006
- Ort
- San Diego
- Beiträge
- 177
- Points
- 4.205
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Just to Translate and further explain my understanding of this, Luaplayer considers your center point (the point at which the object is rotated) to be 0,0,0 . So when you build your object, be sure that you are making 0,0,0 your pivot point. Then no matter where to translate your object to, it will rotate at the center of your object. I mistook the original suggestion as to meaning that I could create my object, translate it to 0,0,0 (after the fact) and then it would rotate correctly, but it didn't quite work like that as I found out. Thanks again for the help.
Zitat von KleptoOne
-= Double Post =-
Its to determine how far to the left, right, up, down the stick is moved. This gives you the freedom to program pressure sensitivity into whatever app you're developing.
Zitat von bumuckl
Geändert von KleptoOne (07-31-2007 um 10:37 AM Uhr) Grund: Automerged Doublepost
-
07-31-2007, 10:44 AM #7844QJ Gamer Blue
- Registriert seit
- Jul 2007
- Ort
- Bavaria!
- Beiträge
- 162
- Points
- 4.021
- Level
- 40
- Downloads
- 0
- Uploads
- 0
ah ok thx a lot...another thing: I dont know to make that real: If u move the dpad left on the x-axis, a picture should move right. Moving the picture aint so hard xD...the problem is, how can i tell my PSP that this should happen when i move dpad left...my code looks like this:
pad = Controls.read()
dx = pad:analogX()
if math.abs(dx) > 32 then
x0 = x0 + dx / sens
end
dy = pad:analogY()
if math.abs(dy) > 32 then
y0 = y0 + dy / sens
end
sens is a variable...soo dont worry, thats not the problem.
so here is the picuter that should be moved right:
screen:blit(box, boy, bg, 0, 0, bg:width(), bg:height(), false)
box and boy are both varibles, in this case, box should increase while holding dpad left...
-
07-31-2007, 12:21 PM #7845words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
As the d-pad can't be pressure sensitive (not without a hardware manipulation) just have
dpad left: x0 = x0 - sens
dpad right: x0 = x0 + sens
dpad up: y0 = y0 - sens
dpad down: y0 = y0 + sens
Change the value of sens should you not want it to move full speed as if the analog were all the way pushed one direction.
...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
07-31-2007, 03:18 PM #7846Developer

- Registriert seit
- Oct 2006
- Ort
- San Diego
- Beiträge
- 177
- Points
- 4.205
- Level
- 41
- Downloads
- 0
- Uploads
- 0
You mean the stick and I can't beleive this code is popping up again, I've explained a million times why this code is flawed... and here it goes again... math.abs() returns the absolute value of a number, meaning if its supposed to be -5, it will return 5, which means it will never go the other way because the number can never be negative... If you want to move something in some direction...
Zitat von bumuckl
Code:pad = Controls.read() if pad:analogX() > 30 then {move a direction} end if pad:analogX() < -30 then {move the other direction} end ....same idea for analogY()...
-
07-31-2007, 06:55 PM #7847
Klepto, you're missing something here:
This code is using the converted analog position only to check if the analog stick has been moved oustide the dead zone, the player movement formula here is using the original signed value of the analog to calculate the new coordinates, which will provide the correct movement. This setup lets you use one value comparison to see if the analog stick has been moved, compared with the two that would be needed without using math.absCode:if math.abs(dy) > 32 then y0 = y0 + dy / sens
-
07-31-2007, 07:54 PM #7848Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Just a small note that this is not just limited to Lua Player, it's a generic 3D thing.
Zitat von KleptoOne

Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
07-31-2007, 10:40 PM #7849Developer

- Registriert seit
- Oct 2006
- Ort
- San Diego
- Beiträge
- 177
- Points
- 4.205
- Level
- 41
- Downloads
- 0
- Uploads
- 0
oh I see, using the real value of dy as your movement speed and sens to limit the amount. Thats actually clever... my sneakers taste like rubber if anyone is wondering;-)
Zitat von Merick
-
08-01-2007, 02:26 AM #7850QJ Gamer Blue
- Registriert seit
- Jul 2007
- Ort
- Bavaria!
- Beiträge
- 162
- Points
- 4.021
- Level
- 40
- Downloads
- 0
- Uploads
- 0
Guys i still dont get it working...the code is :
dx = pad:analogX()
if math.abs(dx) > 32 then
x0 = x0 + dx / sens
box = box - 1
end
if math.abs(dx) < -32 then
x0 = x0 - dx / sens
box = box + 1
end
dy = pad:analogY()
if math.abs(dy) > 32 then
y0 = y0 + dy / sens
end
if math.abs(dy) < -32 then
y0 = y0 - dy / sens
end
The Problem is, when i press Dpad right, the image goes left, thats ok. But when i press Dpad-left, nothing happens, no it continues turnign right while pressing Dpad left...what is worng with it?
-
08-01-2007, 02:35 AM #7851QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
bumuckl:
math.abs returns absolute value from number, means:
so therefore this part:math.abs(-32) = 32
math.abs(32) = 32
will NEVER happenif math.abs(dx) < -32 then
this works for me:
Code:pad = Controls.read() anaX = pad:analogX() anaY = pad:analogY() if anaX > 30 then Player.x = Player.x + (math.abs(pad:analogX())/ana) end if anaX < -30 then Player.x = Player.x - (math.abs(pad:analogX())/ana) end if anaY > 30 then Player.y = Player.y + (math.abs(pad:analogY())/ana) end if anaY < -30 then Player.y = Player.y - (math.abs(pad:analogY())/ana) end
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
08-01-2007, 05:01 AM #7852QJ Gamer Blue
- Registriert seit
- Jul 2007
- Ort
- Bavaria!
- Beiträge
- 162
- Points
- 4.021
- Level
- 40
- Downloads
- 0
- Uploads
- 0
Thy very nice now ive understood...thy very much...ur going to be in the Credits...
-
08-01-2007, 08:26 AM #7853
if anyone missed me,
im still here
Zitat von Da_MerV
-
08-01-2007, 08:34 AM #7854Developer

- Registriert seit
- Oct 2006
- Ort
- San Diego
- Beiträge
- 177
- Points
- 4.205
- Level
- 41
- Downloads
- 0
- Uploads
- 0
Zitat von myschoo
.....my head hurts. Jump back a page to see why the code does work, I made the same mistake at a quick glance, but the previous method is actually better because it doesn't negate the sensitivity of the stick AND it only makes one logic check.
Zitat von bumuckl
-
08-01-2007, 09:00 AM #7855QJ Gamer Bronze
- Registriert seit
- Mar 2007
- Beiträge
- 758
- Points
- 8.665
- Level
- 62
- Downloads
- 0
- Uploads
- 0
what is this "paint bucket" tool you speak of da_merv?
-
08-01-2007, 10:24 AM #7856
you know, click and it fills it with your color, its a basic tool of paint
-
08-01-2007, 01:00 PM #7857
lua player doesn't have one, you'll have to write it yourself
-
08-01-2007, 05:14 PM #7858
ya i know luaplayer doesnt have one. i didnt ask that. i asked how the fill bucket works, i mean, it was done in yPaint, which was written in lua, but yongobongo compiled the script, and i dont have a decompiler, so theres no way i can find out how he did it unless he wants to tell me.
-= Double Post =-
oh, and in the last couple days of research (aka google 24/7), i found the proper name. its called flood fill
-= Double Post =-
oh and even more information, after actually looking at yongobongo's program, i found out the flood fill was implemented horribly, crashes frequently, and doesnt even work all the time.Geändert von Da_MerV (08-01-2007 um 06:24 PM Uhr) Grund: Automerged Doublepost
-
08-03-2007, 04:38 AM #7859.info

- Registriert seit
- Jun 2006
- Ort
- ACT, Australia
- Beiträge
- 1.674
- Points
- 15.395
- Level
- 80
- Downloads
- 0
- Uploads
- 0
I am trying to handle an Image.load() error but it's not working

Is there a different way i should do this?
Code:if not Image.load("test.png") then screen:print(0,0,"error loading image") else test = Image.load("test.png") screen:blit(0,0,test) end
-
08-03-2007, 10:51 AM #7860QJ Gamer Green
- Registriert seit
- Dec 2005
- Ort
- Here
- Beiträge
- 2.715
- Points
- 13.310
- Level
- 75
- Downloads
- 0
- Uploads
- 0
shouldnt 'test = Image.load("test.png") come before luaplayer checks if its there?
Zitat von Yongobongo
i dont know, maybe:
thats my guess.Code:test = Image.load("test.png") if not Image.load("test.png") then screen:print(0,0,"error loading image") else screen:blit(0, 0, test) end
-= Double Post =-
didnt you say you already know how to do it? just improve on it.
Zitat von Da_MerV
-= Double Post =-
yongobongo, tacticalpenguin says:
Zitat von TacticalPenguin on msn
Geändert von EminentJonFrost (08-03-2007 um 11:18 AM Uhr) Grund: Automerged Doublepost


LinkBack URL
About LinkBacks
Mit Zitat antworten


Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum