23.02.2011, 01:56
Hi,
hab seit heute angefangen ein wenig mit Lua rumzubasteln. (kaum bis gar keine programmirkenntnisse vorhanden)
Habe mir dazu dem Hintergundbild aus PSPokemon genommen
und versucht die figur darauf ein wenig laufen zu lassen bzw. ein paar aktionen durchführen zu lassen.
nu würd ich gerne eine animation beim laufen hinbekommen, nur komme ich da nicht sonderlich weiter...hier: http://www.pspking.de/forum/showthread.php?tid=35775&pid=408441#pid408441
hat neuro schon den richtigen denkanstoß gegeben, nur fnd ich nirgents ne richtige umsetzung dafür....
also: ich würde gerne aus diesem sprite:
nach tastendruck padown() das bild ein stück nach rechts fahren lassen...also 3 mal und dann von vorne...immer in 32x32 stücken...
das gleiche natürlich auch für rechts, oben und links...müsste also auch die png auf tastendruck erneuern...nur wie?
hier mal mein bisheriger code:
hab seit heute angefangen ein wenig mit Lua rumzubasteln. (kaum bis gar keine programmirkenntnisse vorhanden)
Habe mir dazu dem Hintergundbild aus PSPokemon genommen
und versucht die figur darauf ein wenig laufen zu lassen bzw. ein paar aktionen durchführen zu lassen.
nu würd ich gerne eine animation beim laufen hinbekommen, nur komme ich da nicht sonderlich weiter...hier: http://www.pspking.de/forum/showthread.php?tid=35775&pid=408441#pid408441
hat neuro schon den richtigen denkanstoß gegeben, nur fnd ich nirgents ne richtige umsetzung dafür....
also: ich würde gerne aus diesem sprite:
nach tastendruck padown() das bild ein stück nach rechts fahren lassen...also 3 mal und dann von vorne...immer in 32x32 stücken...
das gleiche natürlich auch für rechts, oben und links...müsste also auch die png auf tastendruck erneuern...nur wie?
hier mal mein bisheriger code:
Code:
weiss = Color.new(255,255,255)
schwarz = Color.new(0,0,0)
hinterg = Image.load("zone1.png")
ash = Image.load("ash.png")
ash2 = Image.load("ashlinks.png")
ash3 = Image.load("ashrechts.png")
ash4 = Image.load("ashoben.png")
cursor_x = 200
cursor_y = 150
pic=0
timer=0
animation=0
--Mp3.load("a.mp3")
--Mp3.play()
while true do
screen:clear()
--Zone1
--Wand rechts
if cursor_x >443 then
cursor_x=443
end
--Wand oben
if cursor_y <-10 then
cursor_y=-10
end
--Wand unten
if cursor_y >225 then
cursor_y=225
end
--Wand links
if cursor_x <8 then
cursor_x=8
end
--Haus unten rechts
--horizontale ebene
if cursor_x <444 and cursor_x >362 and cursor_y >150 and cursor_y <152 then
cursor_y=150
end
if cursor_x <444 and cursor_x >362 and cursor_y >208 and cursor_y <210 then
cursor_y=210
end
--vertikale ebene
if cursor_x >360 and cursor_y <210 and cursor_y >155 then
cursor_x=360
end
--Haus oben
--horizontale ebene
if cursor_x <170 and cursor_x >80 and cursor_y <28 then
cursor_y=28
end
--vertikale ebene
if cursor_x <173 and cursor_x >170 and cursor_y <30 and cursor_y >-15 then
cursor_x=173
end
if cursor_x >77 and cursor_x <80 and cursor_y <30 and cursor_y >-15 then
cursor_x=77
end
-- Bus
--horizontale ebene
if cursor_x >0 and cursor_x <48 and cursor_y <132 and cursor_y>130 then
cursor_y=132
end
if cursor_x >0 and cursor_x <48 and cursor_y >85 and cursor_y<87 then
cursor_y=85
end
--vertikale ebene
if cursor_x <50 and cursor_y <132 and cursor_y >85 then
cursor_x=50
end
--Baeme links
--vertikale ebene
if cursor_x <30 and cursor_y <130 and cursor_y >-15 then
cursor_x=30
end
--Baeme unten
--horizontale ebene
if cursor_x >0 and cursor_x <270 and cursor_y >200 then
cursor_y=200
end
--vertikale ebene
if cursor_x <272 and cursor_y <250 and cursor_y >200 then
cursor_x=272
end
pad = Controls.read()
function Ashbew ()
if pad:right() then
cursor_x = cursor_x + 1.5
end
if pad:left() then
cursor_x = cursor_x - 1.5
end
if pad:down() then
cursor_y = cursor_y + 1.5
end
if pad:up() then
cursor_y = cursor_y - 1.5
end
end
if pad:down() then
timer = timer + 1
end
if timer > 10 then
animation = animation + 1
timer = 0
if animation > 3 then
animation = 0
end
end
if animation == 0 then
pic = 0
elseif animation == 1 then
pic = 32
elseif animation == 2 then
pic = 64
elseif animation == 3 then
pic = 96
end
Ashbew()
screen:blit(0,0,hinterg,true)
screen:blit(cursor_x, cursor_y, ash, pic, 0, 32, 32)
screen.flip()
screen.waitVblankStart()
end
die animation ist halt nur eine durchgehende bei tastendruck und auch nur eine...brache das ganze natürlich auch für alle anderen richtungen...
nutze Lua Hm7 ;D
und bitte keine antworten wie: nimm pge oder c oder ka
ich würde das gerne mit hm7 lösen...
über hilfe würd ich mich freuen