just use:Zitat:
Zitat von ro0kie42
It will return the variable value instead of the stringCode:tests = "\n" .. test1 .. "\n" .. test2
Printable View
just use:Zitat:
Zitat von ro0kie42
It will return the variable value instead of the stringCode:tests = "\n" .. test1 .. "\n" .. test2
Yep, it's called concatenation. To concatenate, closer the quotes and then 2 dots and then the variable name. If you wanna open the quotes again after the variable, folow it with 2 more dots and reopen the quotes.
Zitat:
Zitat von xpack
doesnt work..:(
ai - By default, the CWD (current working directory) is wherever the EBOOT.PBP is. Meaning loading an image:
Will load image.png from where the EBOOT is. So, by changing the CWD to the root of memory stick, youd have to place image.png on the root of your PSP in order for it find and load image.png.Code:myimage = Image.load("image.png")
Zitat:
Zitat von SG57
yesw i know that but still it wont let me copy anyfile
the problem is, we CANT write or read from MS...Zitat:
Zitat von SG57
i.e. i was in iRshell, started lua app and pressed NOTE to take screenshot, even that didnt worked... somehow it disable ALL ms0:/ functions -_-
Try downgrading then upgrading back to your firmware. Unless you have a copy of your flash0 before the problem. I had a problem with IRSHELL as well now when I press 'O' when listening to music my psp crashs after doing the restart psp to vsh.
ok i found the problem... PROBABLY...
i think it was because i had opened 11 files...(io.open)
when i reduce the number of files to 10, it works OK...
but thanks for help anyway
Just out of curiosity, why would you be opening 10 file simultaneously? Usual practice is to open a file, read and store the data, then close the file before opening another. If your not careful you could corrupt your mem stick.
ok coz i needed file check , i didnt know exactly how to do it so i just used:
blah = io.open("file","r")
if blah then
boo = 1 else boo = 0
end
i tried to use blah:close() but if the file didnt exist, i got error...
do this:Zitat:
Zitat von myschoo
if io.open("file", "r") then
...do stuff...
io.close("file")
else
...print("file does not exist")
end
hey that looks good, i will try :)
edit.
works great,thx again ;)
Thanks! but now how do i read them?Zitat:
Zitat von Fuzzie360
Zitat:
Zitat von xpack
already tried that...
-= Double Post =-
hmm this is really bad...
i cant try my flashing program since it stoped working...:(
it works on other psp's
Use my program FileFlasher to see if it works. If not I recomend a downgrade then an upgrade to see if that fixes the problem
He's having flash issues and your recommending that he formats his Flash0?
Bad advice. Unless you can diagnose the problem dont be too quick to give out that kind of advice.
Can you at least flash USB mode
ai3: post your code here, maybe we can test it or fix something ;)
I'll take a look at it if you want also
I made some animation code for character movement and I made some code for when the character is standing still. I don't know how to get it so that when the player is pressing nothing it will display the character standing still. Could someone help?
I basically want something to set walkflag = true when nothing is being pressed.
Code:dofile("animLib.lua")
background = Image.load("background2.jpg")
cleo = Image.load("cleofacedown.png")
cleowalkdown = ANIM.new(4, "down", "png", "walkdown/")
cleowalkup = ANIM.new(4, "up", "png", "walkup/")
cleowalkleft = ANIM.new(4, "left", "png", "walkleft/")
cleowalkright = ANIM.new(4, "right", "png", "walkright/")
CleoX = 100
CleoY = 100
walkflag = true
cleodown = true
--WALKING AND CONTROL ANIMATIONS--
while true do
pad=Controls.read()
screen:blit(0,0,background)
if pad:down() then
walkflag = false
CleoY = (CleoY + 4)
cleowalkdown:blit(CleoX,CleoY,100)
cleodown = true
cleoup = false
cleoright = false
cleoleft = false
end
if pad:up() then
walkflag = false
CleoY = (CleoY - 4)
cleowalkup:blit(CleoX,CleoY,100)
cleodown = false
cleoup = true
cleoright = false
cleoleft = false
end
if pad:left() then
walkflag = false
CleoX = (CleoX - 4)
cleowalkleft:blit(CleoX,CleoY,100)
cleodown = false
cleoup = false
cleoright = false
cleoleft = true
end
if pad:right() then
walkflag = false
CleoX = (CleoX + 4)
cleowalkright:blit(CleoX,CleoY,100)
cleodown = false
cleoup = false
cleoright = true
cleoleft = false
end
--RESET FACE POSITION--
if walkflag then
if cleodown then
cleo = Image.load("cleofacedown.png")
screen:blit(CleoX,CleoY,cleo)
end
if cleoleft then
cleo = Image.load("cleofaceleft.png")
screen:blit(CleoX,CleoY,cleo)
end
if cleoright then
cleo = Image.load("cleofaceright.png")
screen:blit(CleoX,CleoY,cleo)
end
if cleoup then
cleo = Image.load("cleofaceup.png")
screen:blit(CleoX,CleoY,cleo)
end
end
screen.flip()
screen.waitVblankStart()
end
try this:
one thing, in the "reset face position" section, instead of re-loading images each time you stop after changing direction it would be better to load all four images at the start of your program and put them into a table like this:Code:if not pad:right() and not pad:left() and not pad:up() and not pad:down() then
walkflag = true
end
then, in "reset face position" you could do this:Code:cleo = {}
cleo[1] = Image.load("cleofacedown.png")
cleo[2] = Image.load("cleofaceleft.png")
cleo[3] = Image.load("cleofaceright.png")
cleo[4] = Image.load("cleofaceup.png")
end
Code:if walkflag then
if cleodown then direction = 1 end
if cleoleft then direction = 2 end
if cleoright then direction = 3 end
if cleoup then direction = 4 end
screen:blit(CleoX,CleoY,cleo[direction])
end
PERFECT!
Thank you SO much.
next time. Use animlib :D
remember, states dont automatically reset themselves. ;) dont forget to set a state to false, if its not true anymore. and also, you should use else and elseif's a lot more. it gives you many more extra CPU cycles. you whole code can be made much better just by adding elseif's:
-= Double Post =-Code:dofile("animLib.lua")
background = Image.load("background2.jpg")
cleo = Image.load("cleofacedown.png")
cleowalkdown = ANIM.new(4, "down", "png", "walkdown/")
cleowalkup = ANIM.new(4, "up", "png", "walkup/")
cleowalkleft = ANIM.new(4, "left", "png", "walkleft/")
cleowalkright = ANIM.new(4, "right", "png", "walkright/")
CleoX = 100
CleoY = 100
walkflag = true
cleodown = true
--WALKING AND CONTROL ANIMATIONS--
while true do
pad=Controls.read()
screen:blit(0,0,background)
if pad:down() then
walkflag = false
CleoY = (CleoY + 4)
cleowalkdown:blit(CleoX,CleoY,100)
cleodown = true
cleoup = false
cleoright = false
cleoleft = false
elseif pad:up() then
walkflag = false
CleoY = (CleoY - 4)
cleowalkup:blit(CleoX,CleoY,100)
cleodown = false
cleoup = true
cleoright = false
cleoleft = false
end
if pad:left() then
walkflag = false
CleoX = (CleoX - 4)
cleowalkleft:blit(CleoX,CleoY,100)
cleodown = false
cleoup = false
cleoright = false
cleoleft = true
elseif pad:right() then
walkflag = false
CleoX = (CleoX + 4)
cleowalkright:blit(CleoX,CleoY,100)
cleodown = false
cleoup = false
cleoright = true
cleoleft = false
end
if not pad:right() and not pad:left() and not pad:up() and not pad:down() then
walkflag = true
end
--RESET FACE POSITION--
if walkflag then
if cleodown then
cleo = Image.load("cleofacedown.png")
screen:blit(CleoX,CleoY,cleo)
elseif cleoleft then
cleo = Image.load("cleofaceleft.png")
screen:blit(CleoX,CleoY,cleo)
elseif cleoright then
cleo = Image.load("cleofaceright.png")
screen:blit(CleoX,CleoY,cleo)
elseif cleoup then
cleo = Image.load("cleofaceup.png")
screen:blit(CleoX,CleoY,cleo)
end
end
screen.flip()
screen.waitVblankStart()
end
he is already using it. :pZitat:
Zitat von eldiablov
Mmhmm, I see what you mean Grim. Thank you.
@Merick: Tables you say? I think I'll give it a go. Thanks.
Ok this is really annoying me. Can someone tell me why "w+" mode is not working on luaplayer 0.20?!?! Is there an alternative way to overwrite all existing data in the text file? This is what i wrote, and when i try to write to it i get 'attempt to call file10 - a nil value'
Code:file10 = io.open("data/load.img","w+")
I'm getting a type error I don't understand:
I'm trying to get it so that when you hit the attack button while facing down it will count the attack as taking place if you are pretty much within 10 pixels of the object...Code:if cleodown then
if (MobX - 10 >= CleoX >= MobX + 10) and (MobY - 10 >= CleoY >= MobY + 10) then
screen:blit(-100,-100,monster)
end
end
I get the error "Trying to compare number with boolean" for the second line...but MobX is 150 and MobY is 100 and Cleo X and Y are also numbers...
You must of changed the values of the co-ordinates to a boolean (true/false) somewhere else in the code. Re-check the rest of the code.
Here is my entire code and I don't see how CleoX, CleoY, MobX, MobY could be boolean (But I only started coding yesterday).
Code:dofile("animLib.lua")
monster = Image.load("monster.png")
background = Image.load("background3.jpg")
cleowalkdown = ANIM.new(4, "down", "png", "walkdown/")
cleowalkup = ANIM.new(4, "up", "png", "walkup/")
cleowalkleft = ANIM.new(4, "left", "png", "walkleft/")
cleowalkright = ANIM.new(4, "right", "png", "walkright/")
CleoX = 100
CleoY = 100
MobX = 200
MobY = 150
walkflag = true
cleodown = true
cleo = {}
cleo[1] = Image.load("cleofacedown.png")
cleo[2] = Image.load("cleofaceleft.png")
cleo[3] = Image.load("cleofaceright.png")
cleo[4] = Image.load("cleofaceup.png")
cleo[5] = Image.load("cleoattackdown.png")
cleo[6] = Image.load("cleoattackleft.png")
cleo[7] = Image.load("cleoattackright.png")
cleo[8] = Image.load("cleoattackup.png")
--WALKING AND CONTROL ANIMATIONS--
while true do
pad=Controls.read()
screen:blit(0,0,background)
screen:blit(MobX,MobY,monster)
--Down--
if pad:down() and not pad:cross() and not pad:left() and not pad:right() then
walkflag = false
CleoY = (CleoY + 3)
cleowalkdown:blit(CleoX,CleoY,100)
cleodown = true
cleoup = false
cleoright = false
cleoleft = false
elseif pad:down() and pad:right() and not pad:cross() then
walkflag = false
CleoY = (CleoY + 2)
CleoX = (CleoX + 2)
cleowalkdown:blit(CleoX,CleoY,100)
cleodown = true
cleoup = false
cleoright = false
cleoleft = false
elseif pad:down() and pad:left() and not pad:cross() then
walkflag = false
CleoY = (CleoY + 2)
CleoX = (CleoX - 2)
cleowalkdown:blit(CleoX,CleoY,100)
cleodown = true
cleoup = false
cleoright = false
cleoleft = false
end
--Up--
if pad:up() and not pad:cross() and not pad:left() and not pad:right() then
walkflag = false
CleoY = (CleoY - 3)
cleowalkup:blit(CleoX,CleoY,100)
cleodown = false
cleoup = true
cleoright = false
cleoleft = false
elseif pad:up() and pad:right() and not pad:cross() then
walkflag = false
CleoY = (CleoY - 2)
CleoX = (CleoX + 2)
cleowalkup:blit(CleoX,CleoY,100)
cleodown = false
cleoup = true
cleoright = false
cleoleft = false
elseif pad:up() and pad:left() and not pad:cross() then
walkflag = false
CleoY = (CleoY - 2)
CleoX = (CleoX - 2)
cleowalkup:blit(CleoX,CleoY,100)
cleodown = false
cleoup = true
cleoright = false
cleoleft = false
end
--Left--
if pad:left() and not pad:cross() and not pad:up() and not pad:down() then
walkflag = false
CleoX = (CleoX - 3)
cleowalkleft:blit(CleoX,CleoY,100)
cleodown = false
cleoup = false
cleoright = false
cleoleft = true
end
--Right--
if pad:right() and not pad:cross() and not pad:up() and not pad:down() then
walkflag = false
CleoX = (CleoX + 3)
cleowalkright:blit(CleoX,CleoY,100)
cleodown = false
cleoup = false
cleoright = true
cleoleft = false
end
if not pad:right() and not pad:left() and not pad:up() and not pad:down() and not pad:cross() then
walkflag = true
end
--RESET FACE POSITION--
if walkflag then
if cleodown then direction = 1 end
if cleoleft then direction = 2 end
if cleoright then direction = 3 end
if cleoup then direction = 4 end
screen:blit(CleoX,CleoY,cleo[direction])
end
--ATTACKING--
if pad:cross() then
if cleodown then direction = 5 end
if cleoleft then direction = 6 end
if cleoright then direction = 7 end
if cleoup then direction = 8 end
screen:blit(CleoX,CleoY,cleo[direction])
--ATTACKDAMAGE--
if (MobX - 10 <= CleoX <= MobX + 10) and (MobY - 10 <= CleoY <= MobY + 10) then
MobX = -100
MobY = -100
end
end
screen.flip()
screen.waitVblankStart()
end
Zitat:
Zitat von myschoo
here..Code:Red = Color.new(255, 0, 0)
Blue = Color.new(0,0,200)
function PrintCentered(y,string,color)
screen:print( 240 - (string.len(string)*8) / 2 ,y,string,color);
end
Background = Image.load("background1.png")
System.Unassign("flash0:" )
System.Assign("flash0:", "lflash0:0,0", "flashfat0:")
while true do
current = 1
oldpad = Controls.read()
while true do
pad = Controls.read()
screen:blit(0,0,Background)
PrintCentered(3,"Lua Theme Flasher", Blue)
PrintCentered(18,"By ai3gtmc", Blue)
screen:print(137, 96, "=> 01-12.bmp background", Blue)
screen:print(137, 106, "=> TopMenu_Plugin", Blue)
screen:print(137, 116, "=> Opening_Plugin", Blue)
screen:print(137, 126, "=> Gameboot.PMF", Blue)
screen:print(137, 136, "=> System_Plugin_bg", Blue)
screen:print(137, 146, "=> System_Plugin_fg", Blue)
screen:print(137, 156, "=> System_Plugin", Blue)
screen:print(137, 166, "=> Game_Plugin", Blue)
screen:print(137, 176, "=> photo_plugin", Blue)
screen:print(137, 186, "=> impose_plugin", Blue)
screen:print(137, 196, "=> ltn0.pgf", Blue)
screen:print(137, 210, "=> Enable USB", Blue)
screen:print(137, 220, "=> Disable USB",Blue)
screen:print(137, 240, "=> EXIT", Blue)
if current == 1 then
screen:print(137, 96, "=> 01-12.bmp background", Red)
end
if current == 2 then
screen:print(137, 106, "=> TopMenu_Plugin.rco", Red)
end
if current == 3 then
screen:print(137, 116, "=> Opening_Plugin.rco", Red)
end
if current == 4 then
screen:print(137, 126, "=> Gameboot.PMF", Red)
end
if current == 5 then
screen:print(137, 136, "=> System_Plugin_bg.rco", Red)
end
if current == 6 then
screen:print(137, 146, "=> System_Plugin_fg.rco", Red)
end
if current == 7 then
screen:print(137, 156, "=> System_Plugin.rco", red)
end
if current == 8 then
screen:print(137, 166, "=> Game_Plugin.rco", red)
end
if current == 9 then
screen:print(137, 176, "=> photo_plugin.rco", red)
end
if current == 10 then
screen:print(137, 186, "=> impose_plugin.rco", red)
end
if current == 11 then
screen:print(137, 196, "=> ltn0.pgf", red)
end
if current == 12 then
screen:print(137,210, "=> Enable USB!", red)
end
if current == 13 then
screen:print(137,220, "=> Disable USB!", red)
end
if current == 14 then
screen:print(137, 240, "=> EXIT", red)
end
if pad:up() and oldpad:up() ~= pad:up() then
current = current-1
end
if pad:down() and oldpad:down() ~= pad:down() then
current = current+1
end
if current == 15 then
current = 1
end
if current == 0 then
current = 14
end
if pad:cross() and current == 1 then
System.writeFile("ms0:/theme/01-12.bmp","flash0:/vsh/resource/01-12.bmp","yes")
end
if pad:cross() and current == 2 then
System.writeFile("ms0:/theme/topmenu_plugin.rco","flash0:/vsh/resource/topmenu_plugin.rco","yes")
end
if pad:cross() and current == 3 then
System.writeFile("ms0:/theme/opening_plugin.rco","flash0:/vsh/resource/opening_plugin.rco","yes")
end
if pad:cross() and current == 4 then
System.writeFile("ms0:/theme/gameboot.pmf","flash0:/vsh/resource/gameboot.pmf","yes")
end
if pad:cross() and current == 5 then
System.writeFile("ms0:/theme/system_plugin_bg.rco","flash0:/vsh/resource/system_plugin_bg.rco","yes")
end
if pad:cross() and current == 6 then
System.writeFile("ms0:/theme/system_plugin_fg.rco","flash0:/vsh/resource/system_plugin_fg.rco","yes")
end
if pad:cross() and current == 7 then
System.writeFile("ms0:/theme/system_plugin.rco","flash0:/vsh/resource/system_plugin.rco","yes")
end
if pad:cross() and current == 8 then
System.writeFile("ms0:/theme/game_plugin.rco","flash0:/vsh/resource/game_plugin.rco","yes")
end
if pad:cross() and current == 9 then
System.writeFile("ms0:/theme/photo_plugin.rco","flash0:/vsh/resource/photo_plugin.rco","yes")
end
if pad:cross() and current == 10 then
System.writeFile("ms0:/theme/impose_plugin.rco","flash0:/vsh/resource/impose_plugin.rco","yes")
end
if pad:cross() and current == 11 then
System.writeFile("ms0:/theme/ltn0.pgf","flash0:/vsh/font/ltn0.pgf","yes")
end
if pad:cross() and current == 12 then
System.usbDiskModeActivate()
end
if pad:cross() and current == 13 then
System.usbDiskModeDeactivate()
end
if pad:cross() and current == 14 then
System.Quit()
end
---ScreenShot---
if pad:select() then
Image:save("screenshot.png")
end
if pad:start() then
System.Quit()
end
screen.waitVblankStart()
screen.flip()
oldpad = pad
end
end
it works on other psp's
worked on my psp few days ago...
I didnt edit anything since it worked....
but now it wont work...
Looks to me like youve got a extra 'end' at the end. I dont know if thats true I just went through it really fast.
If you scroll up you'll see my code...but...I also just noticed something:
I tried replacing all the variables in that line with numbers so the line makes sense but it keeps giving me the same error anyways...and I've tried with and without brackets.
The error is: Attempt to compare boolean with number.Code:--ATTACKDAMAGE--
if 140 <= CleoX <= 160 and 190 <= CleoY <= 210 then
MobX = -100
MobY = -100
end
And the line it is listed under is the blank space between --Attack damage-- and the if statement.
try this:
also, you need another "end" at the end of this blockCode:if MobX - 10 <= CleoX and CleoX <= MobX + 10 and MobY - 10 <= CleoY and CleoY <= MobY + 10 then
Code:--ATTACKING--
if pad:cross() then
if cleodown then direction = 5 end
if cleoleft then direction = 6 end
if cleoright then direction = 7 end
if cleoup then direction = 8 end
screen:blit(CleoX,CleoY,cleo[direction])
I need help with trying to get Urameshi to show animation when following Ichigo, here's my code:
Code:white=Color.new(255,255,255)
Level=Image.load("./images/backgrounds/forest1.png")
Sasuke=Image.load("./images/Characters/sasukeleft.png")
------------Good Guy
Ichigo=Image.load("./images/New Characters/Ichigoright.png")
Ichigo1=Image.load("./images/New Characters/Ichigo-left.png")
IchigorRight=Image.load("./images/New Characters/IchigorunRight.png")
IchigorLeft=Image.load("./images/New Characters/IchigorunLeft.png")
IchigobRight=Image.load("./images/New Characters/IchigoblockRight.png")
IchigobLeft=Image.load("./images/New Characters/IchigoblockLeft.png")
Ichigodeath=Image.load("./images/New Characters/Ichigodeath.png")
IchigoPunchr=Image.load("./images/New Characters/IchigofightRight.png")
IchigoPunchl=Image.load("./images/New Characters/IchigofightLeft.png")
---------------Bad Guy
Urameshi=Image.load("./images/Urameshi/Urameshi.png")
Urameshi1=Image.load("./images/Urameshi/Urameshi1.png")
UrameshirRight=Image.load("./images/Urameshi/UrameshiRRun.png")
UrameshirLeft=Image.load("./images/Urameshi/UrameshiLRun.png")
UrameshiPunchr=Image.load("./images/Urameshi/UrameshiPunchRight.png")
UrameshiPunchl=Image.load("./images/Urameshi/UrameshiPunchLeft.png")
UrameshiHurtR=Image.load("./images/Urameshi/HurtRight.png")
UrameshiHurtL=Image.load("./images/Urameshi/HurtLeft.png")
--Right empty
r1=Image.createEmpty(66,45)
r2=Image.createEmpty(66,45)
r3=Image.createEmpty(66,45)
ur1=Image.createEmpty(48,37)
ur2=Image.createEmpty(48,37)
ur3=Image.createEmpty(48,37)
--Left Empty
l1=Image.createEmpty(66,45)
l2=Image.createEmpty(66,45)
l3=Image.createEmpty(66,45)
ul1=Image.createEmpty(48,37)
ul2=Image.createEmpty(48,37)
ul3=Image.createEmpty(48,37)
--Left animation
l1:blit(0,0,IchigorLeft,148,3,66,45)
l2:blit(0,0,IchigorLeft,70,3,66,45)
l3:blit(0,0,IchigorLeft,0,4,66,45)
ul1:blit(0,0,UrameshirLeft,114,1,48,37)
ul2:blit(0,0,UrameshirLeft,59,0,48,37)
ul3:blit(0,0,UrameshirLeft,0,1,48,37)
--Right Animation
r1:blit(0,0,IchigorRight,0,3,66,45)
r2:blit(0,0,IchigorRight,74,3,66,45)
r3:blit(0,0,IchigorRight,146,3,66,45)
ur1:blit(0,0,UrameshirRight,0,1,48,37)
ur2:blit(0,0,UrameshirRight,55,1,48,37)
ur3:blit(0,0,UrameshirRight,115,1,48,37)
r={Ichigo,r1,r2,r3}
l={Ichigo1,l1,l2,l3}
ur={Urameshi,ur1,ur2,ur3}
ul={Urameshi1,ul1,ul2,ul3}
Player={x=0,y=200,w=77,h=54,d=r,f=0,s=2,animt=0,img=Ichigo,oldimg=Ichigo1}
Sasuke={x=400,y=200,w=32,h=38,img=Sasuke}
Urameshi={x=400,y=200,w=48,h=37,d=ul,s=1,animt=0,img=Urameshi,oldimg=Urameshi1}
Timer=0
math.randomseed(os.time())
-------------------------------------------------------functions
function Level1()
while true do
screen:clear()
movePlayer()
chasePlayer(Urameshi)
if collision(Player,Urameshi) and Player.d == r then
Player.img=Ichigodeath
Player.s=0
elseif collision(Player,Sasuke) and Player.d==l then
Player.img=Ichigodeath
Player.s=0
end
if Player.img == Ichigodeath then
Player.x=Player.x
end
screen:blit(0,0,Level)
screen:blit(Player.x,Player.y,Player.img)
screen:blit(Urameshi.x,Urameshi.y,Urameshi.oldimg)
screen.flip()
screen.waitVblankStart()
end
end
----------------------------------------------------------------Not Levels
function pausetillx()
while true do --infinite loop used to pause game
pad = Controls.read()
if pad:cross() then
screen:clear()
while pad:cross() do
screen:clear()
pad = Controls.read()
end
break --breaks loop resuming game
end
end
end
function collision(ob1,ob2)
if (ob1.x + ob1.w > ob2.x) and (ob1.x < ob2.x + ob2.w) and (ob1.y + ob1.h >
ob2.y) and (ob1.y < ob2.y + ob2.h) then
return true
else
return false
end
end
function anim(ob)
ob.img=ob.oldimg
ob.animt = ob.animt + 1
if ob.animt > 15 then
ob.animt = 1
end
if ob.animt < 6 then
ob.img = ob.d[2]
end
if ob.animt > 5 then
ob.img = ob.d[3]
end
if ob.animt > 10 then
ob.img = ob.d[4]
end
end
function chasePlayer(ob)
stallchase = math.random(2)
if ob.x > Player.x then
ob.x=ob.x - 2
anim(Urameshi)
else
if ob.x < Player.x then
ob.x = ob.x + 2
anim(Urameshi)
end
end
end
function movePlayer()
pad=Controls.read()
if pad:right() then
Player.d=r
anim(Player)
Player.x=Player.x+Player.s
else
Player.img=Player.d[1]
end
if pad:left() then
Player.d=l
anim(Player)
Player.x=Player.x-Player.s
end
if pad:cross() then
Player.oldimg = Player.img
if Player.d == r then Player.img=IchigobRight elseif Player.d ==
l then Player.img = IchigobLeft end
Player.s=2
defending=true
end
if defending and not pad:cross() then
defending=false Player.img=Player.oldimg
Player.s=2
end
if pad:square() then
Player.oldimg=Player.img
if Player.d == r then Player.img=IchigoPunchr else if Player.d ==
l then Player.img=IchigoPunchl end
Player.s=2
punching=true
end
if punching and not pad:square() then
punching=false Player.img=Player.oldimg
Player.s=2
end
end
end
oldpad=Controls.read()
crouching=false
defending=false
punching=false
alreadycolliding=true
numberoftimescollide=3
death=true
numberofcollisiontimes=0
movingstate=0
-----------------------------------------------------------------main loop
while true do
screen:clear()
Level1()
screen.flip()
screen.waitVblankStart()
oldpad=pad
end
First of all you have fuctions that you didn't even say what they do from the begining. Like chaseplayer(Urameshi)
Urameshi chases the Player, but it wont animate the chasing so its like he's moving towards Player but he's not technically moving, he's standing
Thats not the point, you never said what chaseplayer does you have to have a function like:
Code:function chaseplayer(playername)
anim(playername)--I just made that up but you get the point.
end
i already have a chasePlayer function though, do i make another?
Works like a charm thank you again for your help. I understand now that I can't check if a variable is between something the traditional way because after the first two steps it'll be either "True" or "False" and True >= 160 makes no sense.Zitat:
Zitat von Merick
this works for me, repaired some errors... try itCode:red = Color.new(255, 0, 0)
Blue = Color.new(0,0,200)
function PrintCentered(y,string,color)
screen:print( 240 - (string.len(string)*8) / 2 ,y,string,color);
end
Background = Image.load("background1.png")
System.Unassign("flash0:" )
System.Assign("flash0:", "lflash0:0,0", "flashfat0:")
current = 1
oldpad = Controls.read()
while true do
pad = Controls.read()
screen:blit(0,0,Background)
PrintCentered(3,"Lua Theme Flasher", Blue)
PrintCentered(18,"By ai3gtmc", Blue)
screen:print(137, 96, "=> 01-12.bmp background", Blue)
screen:print(137, 106, "=> TopMenu_Plugin", Blue)
screen:print(137, 116, "=> Opening_Plugin", Blue)
screen:print(137, 126, "=> Gameboot.PMF", Blue)
screen:print(137, 136, "=> System_Plugin_bg", Blue)
screen:print(137, 146, "=> System_Plugin_fg", Blue)
screen:print(137, 156, "=> System_Plugin", Blue)
screen:print(137, 166, "=> Game_Plugin", Blue)
screen:print(137, 176, "=> photo_plugin", Blue)
screen:print(137, 186, "=> impose_plugin", Blue)
screen:print(137, 196, "=> ltn0.pgf", Blue)
screen:print(137, 210, "=> Enable USB", Blue)
screen:print(137, 220, "=> Disable USB",Blue)
screen:print(137, 240, "=> EXIT", Blue)
if current == 1 then
screen:print(137, 96, "=> 01-12.bmp background", red)
end
if current == 2 then
screen:print(137, 106, "=> TopMenu_Plugin.rco", red)
end
if current == 3 then
screen:print(137, 116, "=> Opening_Plugin.rco", red)
end
if current == 4 then
screen:print(137, 126, "=> Gameboot.PMF", red)
end
if current == 5 then
screen:print(137, 136, "=> System_Plugin_bg.rco", red)
end
if current == 6 then
screen:print(137, 146, "=> System_Plugin_fg.rco", red)
end
if current == 7 then
screen:print(137, 156, "=> System_Plugin.rco", red)
end
if current == 8 then
screen:print(137, 166, "=> Game_Plugin.rco", red)
end
if current == 9 then
screen:print(137, 176, "=> photo_plugin.rco", red)
end
if current == 10 then
screen:print(137, 186, "=> impose_plugin.rco", red)
end
if current == 11 then
screen:print(137, 196, "=> ltn0.pgf", red)
end
if current == 12 then
screen:print(137,210, "=> Enable USB!", red)
end
if current == 13 then
screen:print(137,220, "=> Disable USB!", red)
end
if current == 14 then
screen:print(137, 240, "=> EXIT", red)
end
if pad:up() and oldpad:up() ~= pad:up() then
current = current-1
end
if pad:down() and oldpad:down() ~= pad:down() then
current = current+1
end
if current == 15 then
current = 1
end
if current == 0 then
current = 14
end
if pad:cross() and current == 1 then
System.writeFile("ms0:/theme/01-12.bmp","flash0:/vsh/resource/01-12.bmp","yes")
end
if pad:cross() and current == 2 then
System.writeFile("ms0:/theme/topmenu_plugin.rco","flash0:/vsh/resource/topmenu_plugin.rco","yes")
end
if pad:cross() and current == 3 then
System.writeFile("ms0:/theme/opening_plugin.rco","flash0:/vsh/resource/opening_plugin.rco","yes")
end
if pad:cross() and current == 4 then
System.writeFile("ms0:/theme/gameboot.pmf","flash0:/vsh/resource/gameboot.pmf","yes")
end
if pad:cross() and current == 5 then
System.writeFile("ms0:/theme/system_plugin_bg.rco","flash0:/vsh/resource/system_plugin_bg.rco","yes")
end
if pad:cross() and current == 6 then
System.writeFile("ms0:/theme/system_plugin_fg.rco","flash0:/vsh/resource/system_plugin_fg.rco","yes")
end
if pad:cross() and current == 7 then
System.writeFile("ms0:/theme/system_plugin.rco","flash0:/vsh/resource/system_plugin.rco","yes")
end
if pad:cross() and current == 8 then
System.writeFile("ms0:/theme/game_plugin.rco","flash0:/vsh/resource/game_plugin.rco","yes")
end
if pad:cross() and current == 9 then
System.writeFile("ms0:/theme/photo_plugin.rco","flash0:/vsh/resource/photo_plugin.rco","yes")
end
if pad:cross() and current == 10 then
System.writeFile("ms0:/theme/impose_plugin.rco","flash0:/vsh/resource/impose_plugin.rco","yes")
end
if pad:cross() and current == 11 then
System.writeFile("ms0:/theme/ltn0.pgf","flash0:/font/ltn0.pgf","yes")
end
if pad:cross() and current == 12 then
System.usbDiskModeActivate()
end
if pad:cross() and current == 13 then
System.usbDiskModeDeactivate()
end
if pad:cross() and current == 14 then
System.Quit()
end
---ScreenShot---
if pad:select() then
Image:save("screenshot.png")
end
if pad:start() then
System.Quit()
end
screen.waitVblankStart()
screen.flip()
oldpad = pad
end