R4lph Posted July 26, 2007 Report Share Posted July 26, 2007 Začal jsem se učit LUA a tady je můj tutoš na pohyb: --Simple moving --by R4lph --barvy,obrazky,promenne white = Color.new(255,255,255) --nacteme obrazek hrace hrac = Image.load("player.png") --urcime startovni pozici hrace hrac_x = "10" hrac_y = "10" --hlavni cast while true do screen:clear() --vykreslime obrazek hrace na startovni pozici screen:blit(hrac_x,hrac_y,hrac) screen:print(155,10,"Jednoduchy pohyb",white) screen:print(160,25,"by R4lph",white) --ovladani pad = Controls.read() --budeme odecitat nebo pricitat pixely tak, aby se obrazek pohyboval v danem smeru if pad:left() then hrac_x = hrac_x-3 end if pad:right() then hrac_x = hrac_x+3 end if pad:up() then hrac_y = hrac_y-3 end if pad:down() then hrac_y = hrac_y+3 end -- zmackneme-li start, ukoncime aplikaci if pad:start() then break end --ukoncime aplikaci screen.waitVblankStart() screen.flip() end v příloze je složka luaplayerwindows.tu otevřete a spusťte run.cmd Quote Link to comment Share on other sites More sharing options...
WoKo_O Posted July 26, 2007 Report Share Posted July 26, 2007 wow..vubec tomu teda nerozumim ale je to husty..:D o cem ta LUA je nebo co to ma delat.?? Quote Link to comment Share on other sites More sharing options...
R4lph Posted July 26, 2007 Author Report Share Posted July 26, 2007 Lua je programvaci jazyk pro PSP.a tohle ma delat to, ze se vykresli obrazek a pomoci sipek se pohybuje. Quote Link to comment Share on other sites More sharing options...
*Dave* Posted July 26, 2007 Report Share Posted July 26, 2007 jasny no je to supr ale porad to nechapu :D:D:D Quote Link to comment Share on other sites More sharing options...
R4lph Posted July 26, 2007 Author Report Share Posted July 26, 2007 a co nechapes? Quote Link to comment Share on other sites More sharing options...
mootoo Posted July 26, 2007 Report Share Posted July 26, 2007 int main() {kasli na to, lua je pomala chod do c a kukni do sekcie tutorialov takto sa tutorial nepise !!!,nechcem mat patent na rozum ale necudujem sa ze tomu nechapu, ja to precitam ale tomu co nema o programovani ani paru musis vysvetlit aj to kde zacina loop a kde konci a do kedy bezi :D chapes?; } EDIT:Napriklad si im zabudol napisat ze si musia nahrat nejaky ten obrazok.png do adresara s eboot.pbp:roll: Quote Link to comment Share on other sites More sharing options...
R4lph Posted July 27, 2007 Author Report Share Posted July 27, 2007 jj mas pravdu je to muj prvni tut a asi zkusim to Cecko Quote Link to comment Share on other sites More sharing options...
mootoo Posted July 27, 2007 Report Share Posted July 27, 2007 da sa pisal aj v lua netvrdim ze nie ale velmi rychlo pochopis ze aj ked v c musis rozpisovat niektore veci trochu obsirnejsie ale rychlost ti to vynahradi ;) Quote Link to comment Share on other sites More sharing options...
R4lph Posted July 28, 2007 Author Report Share Posted July 28, 2007 jj uz skousim Cecko.je to sice trochu tezsi ale lepsi Quote Link to comment Share on other sites More sharing options...
myschoo Posted July 29, 2007 Report Share Posted July 29, 2007 ked zapisujes ciselne premenne nemusis ich davat do "" Quote Link to comment Share on other sites More sharing options...
nuguien Posted July 27, 2008 Report Share Posted July 27, 2008 a jak to teda dám tu hru do psp :psp: ?,a teda ta chyba: -- Ukazka Menu -- PaCMAN -- barvy nevm = Color.new(741,321,654) nevim = Color.new(928,721,674) biela = Color.new(248,259,155) selector = Color.new(0,128,255) zelena = Color.new(10,137,143) -- definujem premennu selY = 44 screen:clear() -- vytvorim tzv. "selector" (vid. obrazok) Image:fillRect(4, selY, 120, 10, selector) -- nejake texty + polozky v menu screen:print(140,5, "pacMAN", biela) screen:print(140,12, "--------------------------", zelena) screen:print(5,45, "Nova hra", nevm) screen:print(5,55, "Pokracuj", biela) screen:print(5,65, "Ovladani", biela) screen:print(5,75, "Titulky", biela) screen:print(5,85, "Konec", biela) screen:print(5,115, "---------------------------------------", biela) screen:print(5,135, "Pouzij sipky", biela) screen:print(5,145, "Pouzi (X) pre potvrdenie", biela) pad = Controls.read() -- pohyb selectora za pomoci premmennej selY if pad:down() and oldpad:down() ~= pad:down() then selY = selY + 10 end if pad:up() and oldpad:up() ~= pad:up() then selY = selY - 10 end -- toto zaisti, ze selector bude kruzit v cykle, ak ste na 5. polozke a -- stlacite dole, selector bude na 1. polozke a naopak if selY == 94 then selY = 44 end if selY == 34 then selY = 84 end if selY == 44 and pad:cross() and oldpad:cross() ~= pad:cross() then screen:print(5,250, "zatim nic", nevim) end if selY == 54 and pad:cross() and oldpad:cross() ~= pad:cross() then -- vykona 2. funckiu end if selY == 64 then screen:print(5,250, "W je nahoru.A je do leva.D je do prava.X je dolu.", nevim) end if selY == 74 then screen:print(5,250, "Vytvoreno v roce 2008", biela) screen:print(5,260, "Autorovo jmeno:nuguien", biela) end if selY == 84 and pad:cross() and oldpad:cross() ~= pad:cross() then System.Quit() end screen.waitVblankStart() screen.flip() oldpad = pad end vůbec nevím jak jí spravím, a nevím jaká to je ta chyba :blink::cry: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.