:icon_sad:Zitat:
Zitat von Tritoch
...aww man...(lol)
:icon_razz
Printable View
:icon_sad:Zitat:
Zitat von Tritoch
...aww man...(lol)
:icon_razz
In my code, all the graphics keep blinking and they should just stay in the center if you move the player close enough to the wolf. Also, the wolfs health should erase so the new value will not write over the old one. Here is my code, any help would be great!
grass = Image.load("grass.png")
player = Image.load("player.png")
wolf = Image. load("wolf.png")
oldpad = Controls.read()
red = Color.new(255,0,0)
green = Color.new(0,255,0)
screenwidth = 480 - player:width()
screenheight = 272 - player:height()
Player = {}
Player[1] = { x = 100, y = 50 }
Player[2] = { Health = 100, Weapon = "Sword", Level = 1, Type = "Warrior"}
Player[3] = { Exp = 0 }
Wolf = {}
Wolf[1] = { x = 250, y = 150 }
Wolf[2] = { Health = 100, Weapon = "Claws", Type = "Wolf", Level = 1}
--Label the fighting sequence for the Function fight
function Fight()
--Paste in the grass
for a = 0, 14 do
for b = 0,8 do
screen:blit(32 * a, 32 * b, grass)
end
end
--Paste player and enemy in center
screen:blit(75,125, player)
screen:blit(200,125, wolf)
screen:print(1,1,"Fight!! !")
screen:print(50,50,"Weapo n: " .. Player[2].Weapon, red)
screen:print(250,125,"Wea pon: " .. Wolf[2].Weapon, red)
screen:print(250,150,"Typ e: " .. Wolf[2].Type, red)
screen:print(250,175,"Lev el: " .. Wolf[2].Level, red)
screen:print(50,75,"Type: " .. Player[2].Type, red)
screen:print(50,100,"Leve l: " .. Player[2].Level, red)
screen.flip()
while true do
screen:print(250,100,"Wol f's Health: " .. Wolf[2].Health, green)
screen:print(50,25,"Playe r's Health: " .. Player[2].Health, green)
screen:flip()
pad = Controls.read()
if pad:cross() and oldpad:cross() ~= pad:cross() and Wolf[2].Health > 0 then
Wolf[2].Health = Wolf[2].Health - 5
end
oldpad = pad
screen.waitVblankStart()
end
end
while true do
pad = Controls.read()
screen:clear()
for a = 0, 14 do
for b = 0, 8 do
screen:blit(32 * a, 32 * b, grass)
end
end
screen:blit(Player[1].x, Player[1].y, player)
screen:blit(Wolf[1].x, Wolf[1].y, wolf)
--Check to see if they are near enough to battle
xvalue = Player[1].x - Wolf[1].x
yvalue = Player[1].y - Wolf[1].y
if xvalue < 0 then
xvalue = xvalue * -1
end
if yvalue < 0 then
yvalue = yvalue * -1
end
if xvalue < 90 and yvalue < 40 or xvalue < 90 and yvalue <40 then
screen:clear()
Fight()
end
if pad:left() and Player[1].x > 0 then
Player[1].x = Player[1].x - 2
end
if pad:right() and Player[1].x < screenwidth then
Player[1].x = Player[1].x + 2
end
if pad:up() and Player[1].y > 0 then
Player[1].y = Player[1].y - 2
end
if pad:down() and Player[1].y < screenheight then
Player[1].y = Player[1].y + 2
end
screen.waitVblankStart()
screen.flip()
end
the smileys should be periods and then a 'p' btw
hmm, sorry if this has been asked and answered before but i don't have time to trawl through 220 pages :p
I've managed to incorporate sounds in .wav format, but they take up too much space and are not good enough quality.
i was wondering how i go about making / converting to .XM format which was included with the luaplayer download.
thanks in advance, Tri
xm is a tracker format, compare it to midi but the latter unfortunately is not included
you must keep the wavs at 11250,8-bit mono max, at least that's what i'm using, not to get in trouble with mikmod. (or you could compile a newer ver of mikmod or sth to play midis?)
wav 2 xm is not an option, just too big. (you could use a wav as a single track and use it like a sample)
Isnt the screen:flip() supposed to be screen.flip()?Zitat:
Zitat von emericaska8r
Is there a way how to see if the LuaPlayer doesn't find a file?
I mean so i can make it skip to load the ect. picure so it donsen't gives a error and forces you to restart?
This is the third time i ask this!
the only way you can possibly do that (as far as I know) is put comment parts in your code then when you need it back to normal take away the comment marks.
just explaining PopcOrn DeVil's answer.
Code:-->anything in the same line as the "--" marks are not read.
>This line, however, is read and will result in an error since its not code.
No no no! WTF, i am not stupid!
It's like this: In my program Graphic Creator 2.0, that will be released as soon as i fix this last piece. It would load the latest saved work you have done, BUT if you don't have any work done it would be an error "Couldent find the file (xx.png)", and you will be forced to restart the LuaPlayer.
I would like it to jump over the loading of the picure, i would be something with a "return" comand, no one seems to know how to use it.