Anyone can help me how to solve this problem in the creation of grids: There's no frame for x = 7 and y = 1?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
gutborn
Prole
Posts: 2
Joined: Fri Nov 22, 2019 11:46 am

Anyone can help me how to solve this problem in the creation of grids: There's no frame for x = 7 and y = 1?

Post by gutborn »

Code: Select all


--this code will create the running animation character
local anim_char = require 'anim8'
local posX = 100 
local direction = true 


function love.load()
  img = love.graphics.newImage('character/sprites.png')
  local grid = anim_char.newGrid(86, 109, img:getWidth(), img:getHeight())
  animation = anim_char.newAnimation(grid('1-7',  1, '1-7', 2, '1-7', 3, '1-6', 4), 0.09)--
end


function love.update(dt)
  --movimentos para a esquerda
  if love.keyboard.isDown('left') then
    posX = posX - 150 * dt
    direcao = false
    animation: update(dt)
  end
  --movimentos pra direita
  if love.keyboard.isDown then
    posX = posX + 150 * dt
    direcao = true
    animation: update(dt)
  end
end


function love.draw()
  love.graphics.setBackgroundColor(255, 255, 255)
  if direcao then
     animation:draw(imagem, posX, 50, 0, 1, 1, 43, 0)
  elseif not direcao then
    animation:draw(imagem, posX, 50, 0, -1, 1, 43, 0)
  end
end




*When i run the code this is what happens:
Error

anim8.lua:59: There is no frame for x=7, y=1


Traceback

[C]: in function 'error'
anim8.lua:59: in function 'getOrCreateFrame'
anim8.lua:87: in function 'grid'
main.lua:15: in function 'load'
[C]: in function 'xpcall'
[C]: in function 'xpcall' 
GAME.zip
(93.94 KiB) Downloaded 129 times
randomnovice
Party member
Posts: 126
Joined: Sat May 09, 2015 9:15 pm

Re: Anyone can help me how to solve this problem in the creation of grids: There's no frame for x = 7 and y = 1?

Post by randomnovice »

Hello,

I could be wrong but I think the problem is with the sizing of the image "sprites.png".

I was able to get past that particular error by editing line 13 to say:

Code: Select all

local grid = anim_char.newGrid(76, 88, img:getWidth(), img:getHeight())
and using the attached image (which I've removed the border from).

However you'll now find a new error as on line 42 you want to draw something called 'imagem'. I'm not sure what you're referring to with that one.

Good luck with the next part of your game.
Attachments
sprites.png
sprites.png (332.51 KiB) Viewed 2643 times
gutborn
Prole
Posts: 2
Joined: Fri Nov 22, 2019 11:46 am

Re: Anyone can help me how to solve this problem in the creation of grids: There's no frame for x = 7 and y = 1?

Post by gutborn »

Thaaaaaaanks!!!
Now i'll just apply the changes!!
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 224 guests