KINGx - Das inoffizielle PlayStation Forum & News Portal

Normale Version: LUA:Charaktere hinzufügen und bewegen????
Sie sehen gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Wie füge ich ein Charakter in mein LUA-Spiel ein also das er nach rechts/links laufen kann und auch zwei Attacken einsetzen kann???
Hab insgesamt 16 Bilder des Charakters 4 Pro bewegung(links,rechts,attacke1,attacke2)...und schon ein Menü+Credits+(noch in Arbeit)ein Kleines Menü damit sich der Spieler einen Namen schreiben kann gecodet!
das hab ich auch gefragt aber scheint niemanden zu interressieren was wir an hilfe brauchen -.-

kannst du mir vielleicht den Link für die bilder geben ?


Edit: bewegungen machst du mit Kolisionen hier mal ein link der dir vielleicht weiter helfen kann http://www.pspking.de/forum/showthread.php?tid=12954
Hilft leider nicht Sad
Ich will doch nur ein nen Charakter hinzufügen und den dann nach rchts und licks bewegen Sad
Ds hat ja nicht geholfen....
mein animationsproblem hab ich so gelöst:
http://www.pspking.de/forum/showthread.php?tid=35911&pid=409470#pid409470

dabei ist die bewegung und die animation unabhängig voneinander...
die animation wird duch nen timer getriggert...
sicher nicht die beste art, aber es funktioniert einigermaßen ;D
Kannst du mal das ganze script posten???
Also nur falls ich das verwenden darf...

Code:
weiss = Color.new(255,255,255)
schwarz = Color.new(0,0,0)
hinterg = Image.load("zone1.png")
ash = Image.load("ash.png")
cursor_x = 200
cursor_y = 150
pic=0
timerup=0
timerdown=0
timerright=0
timerleft=0
animation=1
--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
timerdown = timerdown + 0.125
end
if timerdown == 0.125 then
    animation = 1
elseif timerdown == 1 then
    animation = 2
elseif timerdown == 2 then
    animation = 3
end
      
        if timerdown > 3 then
        timerdown = 0
        end

---------------------------------------
-------------------------------------
if pad:down() and pad:left() then
timerdown = timerdown + 0.125
end
if timerdown == 0.125 then
    animation = 1
elseif timerdown == 1 then
    animation = 2
elseif timerdown == 2 then
    animation = 3
end
      
        if timerdown > 3 then
        timerdown = 0
        end

---------------------------------------
-------------------------------------
if pad:down() and pad:right() then
timerdown = timerdown + 0.125
end
if timerdown == 0.125 then
    animation = 1
elseif timerdown == 1 then
    animation = 2
elseif timerdown == 2 then
    animation = 3
end
      
        if timerdown > 3 then
        timerdown = 0
        end

---------------------------------------
if pad:up() then
timerup = timerup + 0.125
end
if timerup == 0.125 then
    animation = 7
elseif timerup == 1 then
    animation = 8
elseif timerup == 2 then
    animation = 9
end
      
        if timerup > 3 then
        timerup = 0
        end

------------------------------------
---------------------------------------
if pad:up() and pad:left()then
timerup = timerup + 0.125
end
if timerup == 0.125 then
    animation = 7
elseif timerup == 1 then
    animation = 8
elseif timerup == 2 then
    animation = 9
end
      
        if timerup > 3 then
        timerup = 0
        end

------------------------------------
---------------------------------------
if pad:up() and pad:right() then
timerup = timerup + 0.125
end
if timerup == 0.125 then
    animation = 7
elseif timerup == 1 then
    animation = 8
elseif timerup == 2 then
    animation = 9
end
      
        if timerup > 3 then
        timerup = 0
        end

------------------------------------
------------------------------------
if pad:right() then
timerright = timerright + 0.125
end
if timerright == 0.125 then
    animation = 4
elseif timerright == 1 then
    animation = 5
elseif timerright == 2 then
    animation = 6
end
      
        if timerright > 3 then
        timerright = 0
        end

------------------------------------
------------------------------------
if pad:left() then
timerleft = timerleft + 0.125
end
if timerleft == 0.125 then
    animation = 10
elseif timerleft == 1 then
    animation = 11
elseif timerleft == 2 then
    animation = 12
end
      
        if timerleft > 3 then
        timerleft = 0
        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
elseif animation == 4 then
pic = 128
elseif animation == 5 then
pic = 160
elseif animation == 6 then
pic = 192
elseif animation == 7 then
pic = 224
elseif animation == 8 then
pic = 256
elseif animation == 9 then
pic = 288
elseif animation == 10 then
pic = 320
elseif animation == 11 then
pic = 352
elseif animation == 12 then
pic = 384
end



Ashbew()

screen:blit(0,0,hinterg,true)

screen:blit(cursor_x, cursor_y, ash, pic, 0, 32, 32)
screen:print(350,20,"Hodges Pokemap",weiss)
screen.flip()
screen.waitVblankStart()
end


und die bilder:





probleme gibt es nur wenn man in 2 richungen gleichzeitig läuft...dann kommt die animation manchmal durcheinander...

Okay,ich schau es mir später in ruhe an Big Grin

[b]EDIT:
was muss ich machen,damit ich das bei mehreren Bildern benutzen kann???
Also ich meine ich habe pro richtung 4 Bilder damit mein e Figur geht....
Referenz-URLs