this question may sound dumb....I was loading a game i made, and i got an error stating: libpng: Not a PNG file
but all my pics are PNG/png
what do i do?
Printable View
this question may sound dumb....I was loading a game i made, and i got an error stating: libpng: Not a PNG file
but all my pics are PNG/png
what do i do?
specify if its .png or .PNG, ect.
oh i just went in Paint and re-did the extensions, thanksZitat:
Zitat von SG57
now bout the resizer function
Wow magician posted a link for you...
i dont have privelages too itsaid
O well here it is:
smile = Image.load("smiley.png")
function scaleImage(newX, newY, theImage)
newImage = Image.createEmpty(newX, newY)
for x = 1, newX do
for y = 1, newY do
newImage:blit(x,y , theImage, math.floor(x*(theImage:wi dth()/newX)),math.floor(y*(theI mage:height()/newY)), 1, 1)
end
end
return newImage
end
--main program
screen:blit(0, 0, smile)
screen:blit(0, 100, scaleImage(200,100,smile) )
screen:blit(100, 0, scaleImage(20,100,smile))
screen:flip()
screen.waitVblankStart(60 0)
thank you alot now ehn u said:
smile = Image.load("smiley.png")
function scaleImage(newX, newY, theImage)
newImage = Image.createEmpty(newX, newY)
for x = 1, newX do
for y = 1, newY do
newImage:blit(x,y , theImage, math.floor(x*(theImage:wi dth()/newX)),math.floor(y*(theI mage:height()/newY)), 1, 1)
end
end
return newImage
end
do i just put my picture instead of "smiley.png" and it should work or do i have to mod it abit so it fits my pictures dimensions and such
also, am i basically defining the function then putting it in the loop or what cause im new to this "function" stuff for LUA everything else cool
so basically, can u just tel me how i could put my picture in their instead of smiley so i can get the hang of this function thing? thx alot if u can
==edit==
right now my dimensions of my picture are 400, 272
and where do iput the new dimensions? where you put the () after height and width next to newX and newY or what? sorry bout questions, just that ican make my game now that idont have to worry bout resizing if i can take ascreenshot when its resized lol and im done!:Jump: :Jump: :Jump: :Jump: :Jump: :Jump: :Jump: :Jump: :Jump: :Jump:
I have been working with a movement script for my game, analog doesn't move make my character move in all directions, only left, right, up and down. how do i make it so moves anyway i push that analog?
here is my coding:
Code:System.usbDiskModeActivate()
sprite = Image.load("jet2.png")
menubg = Image.load("menubg.png")
red = Color.new(255, 0, 0)
black = Color.new(0, 0, 0)
-- Players current X coord
pcXpos = 30
-- Players current Y coord
pcYpos = 115
-- Show the X/Y coords to adjust the movement #'s
screen:print(0, 0, tostring(pcXpos), red)
screen:print(0, 0, tostring(pcYpos), red)
function updateMove(xPos, yPos)
--{
analogPad = Controls.read()
dx = analogPad:analogX()
dy = analogPad:analogY()
-- Up
if dx > -60 and dx < 40 and dy == -128 or analogPad:up() then
pcYpos = pcYpos - 4
playerDirection = "up"
end
-- Left
if dy > -25 and dy < 40 and dx == -128 or analogPad:left() then
pcXpos = pcXpos - 4
playerDirection = "left"
end
-- Down
if dx > -40 and dx < 40 and dy == 127 or analogPad:down() then
pcYpos = pcYpos + 4
playerDirection = "down"
end
-- Right
if dy > -35 and dy < 45 and dx == 127 or analogPad:right() then
pcXpos = pcXpos + 4
playerDirection = "right"
end
-- Check to see if player is off screen
if pcXpos >= 431 then -- Subtract sprite width
pcXpos = 430
elseif pcXpos < 0 then
pcXpos = 00
end
if pcYpos >= 234 then -- Subtract sprite height
pcYpos = 232
elseif pcYpos < 0 then
pcYpos = 00
end
--}
end
while true do
screen:clear(black)
updateMove()
screen:blit(0, 0, menubg)
screen:blit(pcXpos, pcYpos, sprite)
pad = Controls.read()
if pad:start() then break end
screen.waitVblankStart()
screen.flip()
end
Same way you are doing it, just add some more if's for other analog posistions..