same lol!Zitat:
Zitat von EminentJonFrost
Printable View
same lol!Zitat:
Zitat von EminentJonFrost
clipping is a way of only displaying part of an image, the image is not edited so your still able to preform tasks on it or clip other sections:
http://img265.imageshack.us/img265/2...exampledd5.png
...just needed to clear that up.
GuitarGod1134, use the 8th parameter of blit, "alpha" stands for alpha transparency setting it to true makes the lua player read alpha channels make parts of the image transparent, there has to be transparency in the image obviously.
*just following up with what he's saying*...which is made with an image editor.Zitat:
Zitat von eyece
ask if you need help on doing it with the Gimp, its really simple.
oh, just a note, to use the gimp you have to get something called GTK+ runtime environment. its on the same site as Gimp, so no worries.
I've just started in Lua an Im making pong.
I'm onto the collision detection, but it doesnt seem to work....
Heres the code:
And heres the full code:Code:function moveBall(paddle )
if (ball[1].x + ballimg:width() < paddle.x) and (ball[1].x > paddle.x + paddleimg:width( ))
then
ball[1].x = ball[1].x + 2
end
if (ball[1].x + ballimg:width( ) > paddle.x ) and (ball[1].x < paddle.x + paddleimg:width( ))
then
ball[1].x = ball[1].x - 2
end
end
Spoiler for Full code:
It hits the right paddle, then just moves back and forth.
How do I fix this?
i was answering eyece...Zitat:
Zitat von EminentJonFrost
anyway
DOES ANYONE KNOW HOW TO COPY FILE FROM DIRECTORY1 to DIRECTORY2 ??
i want to know this, but just make the image partially transparent so you can fade in and out.Zitat:
Zitat von GuitarGod1134
i tried what SG57 was saying earlier to fade in and out but it didn't seem to work
ahh Pong :) that was my first Lua program too :) (PvP Pong)Zitat:
Zitat von Blake1
let me take a look see.....
i guessZitat:
DOES ANYONE KNOW HOW TO COPY FILE FROM DIRECTORY1 to DIRECTORY2 ??
did not work?Code:System.rename("ms0:/folder0/file.file", ms0:/folder1/file.file")
i don't know, i don't even know how to open/read a file, i have not used those functions yet.
Ill just make the background the same color as my background so it just sinks in.
it worked in PC..or it looked like it worked but nt very well in PSPZitat:
Zitat von eyece
Is any body here Good at GFX ? if so please PM me, I need a menu...
Thank you
Hey - I need someone to test this out for me...
Save it as .lua nd run it on the PSP... tell me what happens please? An error spat out if there is one as well please.Code:scene = {}
scene[1] = {newcolor = {r=0,g=0,b=0,a=0},
finalcolor = Color.new(0,0,0),
screencolor = Color.new(0,0,0),
image=Image.createEmpty(480,272)}
scene[2] = {newcolor = {r=0,g=0,b=0,a=0},
finalcolor = Color.new(0,0,0),
screencolor = Color.new(0,0,0),
image=Image.createEmpty(480,272)}
scene[3] = {newcolor = {r=0,g=0,b=0,a=0},
finalcolor = Color.new(0,0,0),
screencolor = Color.new(0,0,0),
image=Image.createEmpty(480,272)}
scene_num = 1
time = 0
pi = math.atan(1) * 4
i=0
y=0
x=0
while true do
for x=0,480 do
for y=0,272 do
scene[scene_num].screencolor = screen:pixel(x,y) -- get pixel color
scene[scene_num].newcolor = scene[scene_num].screencolor:colors() -- give it to new table
scene[scene_num].newcolor.a = 255/scene_num-40/scene_num -- edit transparency value
scene[scene_num].finalcolor = Color.new(scene[scene_num].newcolor.r,scene[scene_num].newcolor.g,scene[scene_num].newcolor.b,scene[scene_num].newcolor.a)
scene[scene_num].image:pixel(x,y,scene[scene_num].finalcolor) -- give that color to the old scene
end
end
scene_num = scene_num + 1
if scene_num > 3 then scene_num = 1 end
screen:clear()
x = math.sin(pi * 2 / 360 * time) * 150 + 180.5
screen:print(x, 100, "Does this blur?", Color.new(0,255,0))
time = time + 1
if time >= 360 then time = 0 end
for i=1,3 do screen:blit(0,0,scene[i].image) end
screen.waitVblankStart()
screen.flip()
end
line 26, argument was incorrect.
its because you have this:screen pixel index only goes to 479 and 271, common mistake.Code:for x=0,480 do
for y=0,272 do
Ahh - ok. I thought LUA for loops used a '<' operator on default, i guess its '<=' now. Thanks for that.
Can you test it once its fixed? As in, if anyone else sees it use this please:
That should simulate a 'motion blur' you find in most games for when you get hit of some sort... Note, its not using hardware accelerated blending, so i dont know if this will work as it shuld or not.Code:scene = {}
scene[1] = {newcolor = {r=0,g=0,b=0,a=0},
finalcolor = Color.new(0,0,0),
screencolor = Color.new(0,0,0),
image=Image.createEmpty(480,272)}
scene[2] = {newcolor = {r=0,g=0,b=0,a=0},
finalcolor = Color.new(0,0,0),
screencolor = Color.new(0,0,0),
image=Image.createEmpty(480,272)}
scene[3] = {newcolor = {r=0,g=0,b=0,a=0},
finalcolor = Color.new(0,0,0),
screencolor = Color.new(0,0,0),
image=Image.createEmpty(480,272)}
scene_num = 1
time = 0
pi = math.atan(1) * 4
i=0
y=0
x=0
while true do
for x=0,479 do
for y=0,271 do
scene[scene_num].screencolor = screen:pixel(x,y) -- get pixel color
scene[scene_num].newcolor = scene[scene_num].screencolor:colors() -- give it to new table
scene[scene_num].newcolor.a = 255/scene_num-40/scene_num -- edit transparency value
scene[scene_num].finalcolor = Color.new(scene[scene_num].newcolor.r,scene[scene_num].newcolor.g,scene[scene_num].newcolor.b,scene[scene_num].newcolor.a)
scene[scene_num].image:pixel(x,y,scene[scene_num].finalcolor) -- give that color to the old scene
end
end
scene_num = scene_num + 1
if scene_num > 3 then scene_num = 1 end
screen:clear()
x = math.sin(pi * 2 / 360 * time) * 150 + 180.5
screen:print(x, 100, "Does this blur?", Color.new(0,255,0))
time = time + 1
if time >= 360 then time = 0 end
for i=1,3 do screen:blit(0,0,scene[i].image) end
screen.waitVblankStart()
screen.flip()
end
So? can anyone test it and tell me what it does?
-= Double Post =-
I just tested it on WLP, and it doesnt support alpha values other than 255 or 0, so it obviously looks messed. But, the framerate was slow,...
i tried it on luaplayer windows and it says:
error: script.lua:26: An argument was incorrect
a.k.a.
scene[scene_num].screencolor = screen:pixel(x,y) -- get pixel color
i'm using luaplayer.20; and the error it is picking up is the screen:pixel(x,y) i'm not sure if this luaplayer version just doesn't know the command or something. if i get the chance i'll test it on my psp too though. but i'm going to sleep.
i tried it SG57, it was indeed slow on the psp, about 1 frame every 2 minutes actually :P
but from what i could see (1 line of text) it did blur.
emerica - I know, read the post above yours.
eyece - Yes, i expected it to blurr (since whilst programming it, it all seemed to add up to motion blurr) but its those damn for loops killing myspeed. 480*272*n frames = total # of cycles... Im going to think up a way to get the screens colors without hte massive for loop...
Ill post back here with a new version, so please someone stay on? It should only take ~5 minutes.
Can lua right to flash 0? and 1?
Ok...
Someone test this please?
This runs at a very decent framerate on my PCCode:scene = {}
scene[1] = {newcolor = {r=0,g=0,b=0,a=0},
finalcolor = Color.new(0,0,0),
screencolor = Color.new(0,0,0),
image=Image.createEmpty(480,13)}
scene[2] = {newcolor = {r=0,g=0,b=0,a=0},
finalcolor = Color.new(0,0,0),
screencolor = Color.new(0,0,0),
image=Image.createEmpty(480,13)}
scene[3] = {newcolor = {r=0,g=0,b=0,a=0},
finalcolor = Color.new(0,0,0),
screencolor = Color.new(0,0,0),
image=Image.createEmpty(480,13)}
scene_num = 1
time = 0
pi = math.atan(1) * 4
i=0
y=0
x=0
while true do
for x=0,479 do
for y=130,142 do
scene[scene_num].screencolor = screen:pixel(x,y) -- get pixel color
scene[scene_num].newcolor = scene[scene_num].screencolor:colors() -- give it to new table
scene[scene_num].newcolor.a = 255/scene_num-40/scene_num -- edit transparency value
scene[scene_num].finalcolor = Color.new(scene[scene_num].newcolor.r,scene[scene_num].newcolor.g,scene[scene_num].newcolor.b,scene[scene_num].newcolor.a)
scene[scene_num].image:pixel(x,y-130,scene[scene_num].finalcolor) -- give that color to the old scene
end
end
scene_num = scene_num + 1
if scene_num > 3 then scene_num = 1 end
screen:clear()
x = math.sin(pi * 2 / 360 * time) * 150 + 180.5
screen:print(x, 131, "Does this blur?", Color.new(0,255,0))
time = time + 1
if time >= 360 then time = 0 end
for i=1,3 do screen:blit(0,130,scene[i].image) end
screen.waitVblankStart()
screen.flip()
end
-= Double Post =-
theundead - not that i know of. Itd be a quick fix though, Im sure i could quickly write up a lua command for it...
Its running super slow on the PSP.
Somehow I doubt you even tried it. Tell me what it looks like... Does it blurr or print anything at all?
It prints a green text in the middle of the screen thats says "does this blur?" then it starts to blur, But at a really slow rate
You thought i didn't try it? :(
I have no way to tell if you did try it. One reason is because all youve said can easily be obtained just by reading the middle of my code, and my post. And another way is because it says "Does this blur?", not lowercase d.
-= Double Post =-
Also, not to be mean, but whatd you do to get Dev status? I cant recall seeing your name pop up with a game... Like, for yoursam its Wedge Racer, AhMan its irshell, etc.
it works awesome, SG57 though i couldn't for the life of me get it to fully clear the screen so i didn't keep getting a clip of lowser in the background (witch was also being blurred), sweet script, whats it for anyway.
eyece - You mean to say it actually works? :) I was going to use it in my FPS Call of Duty 2 - PSP Edition for when you get hit, and for when you die. As for hte clipping of lowser in the background... Add this BEFORE the while true do loop and tell me if it fixes it
That should remove any lowser residue.Code:screen:clear()
screen.waitVblankStart()
screen.flip()
Think you could video or describe how it is? Id like to know more..
Well i didnt think i had to exactly match wording, If i did read the middle of your code, Dont you think i would have gotten it right? I did run it, But it took a long time for it to blur, then after letting it run for awhile you couldnt tell what was one the screen cause it blurred so much.
:/ i didn't post this yet... and i sure as hell didn't do it twice :PZitat:
wait, you have yet to see it in action? :/
lost your psp or something?
ill get a screen of it on the psp, i want to see it as if full speed, so i'm gonna save to file and make it into a gif.
-= Double Post =-
wait, you have yet to see it in action? :/
lost your psp or something?
I tried clearing / flipping the screen first, it did not work for some reason.
ill get a screen of it on the psp, i want to see it as if full speed, so i'm gonna save to file and make it into a gif.
I dont have a PSP... I lost it. Everything ive devd is PSPless. Hopefully people see that as a handicap for me.
ta-da!:
http://img201.imageshack.us/img201/8...mation1gk6.gif
edit:
ouch, your like a mozart of homebrew.
sounds like all he needs to do to speed it up is increase an integer somewhere, not sure though cuz I did not run it nor did look at the code, best of luck :tup: Can't wait to see that effect in action.Zitat:
Zitat von Anti-QJ