🤑 Indie game store🙌 Free games😂 Fun games😨 Horror games
👷 Game development🎨 Assets📚 Comics
🎉 Sales🎁 Bundles
(Edited 3 times)

thank you for your help! now that i started to understand how it work but i encounter another problem with lua code: apparently, it doesn't work because i don't get the sprite animated.

here the code so far:

-- spritelib-start
player_alt_idle_big21={width=8,unique=41,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,17,18,19,20,21,-1,-1,-1,47,48,62,71,51,-1,-1,-1,-1,78,88,89,90,-1,-1,114,115,116,117,118,119,-1,-1,158,159,160,161,162,163,164,-1,214,-1,215,216,217,218,219,-1,-1,-1,265,266,267,268,269}}
player_alt_idle_big22={width=8,unique=42,total=64,spriteIDs={-1,-1,6,7,8,9,10,-1,-1,-1,30,31,32,33,34,-1,-1,-1,-1,72,73,74,75,-1,-1,-1,-1,78,88,98,97,-1,-1,114,115,131,132,133,119,-1,-1,158,159,176,177,178,163,164,-1,214,-1,239,240,222,218,219,-1,-1,-1,265,266,267,268,269}}
player_alt_idle_big23={width=8,unique=42,total=64,spriteIDs={-1,-1,6,7,8,9,10,-1,-1,-1,30,31,32,35,36,-1,-1,-1,-1,72,73,76,75,-1,-1,-1,-1,78,99,100,97,-1,-1,114,115,131,134,135,136,-1,-1,158,159,176,179,180,181,164,-1,214,-1,239,240,222,218,219,-1,-1,-1,265,266,267,268,269}}
player_alt_idle_big24={width=8,unique=42,total=64,spriteIDs={-1,-1,6,7,8,9,10,-1,-1,-1,30,31,32,35,36,-1,-1,-1,-1,72,73,77,75,-1,-1,-1,-1,78,101,102,97,-1,-1,114,115,131,137,138,119,-1,-1,158,159,176,182,183,184,185,-1,214,-1,239,240,241,242,243,-1,-1,-1,265,266,279,280,281}}
player_alt_idle_big25={width=8,unique=42,total=64,spriteIDs={-1,-1,6,7,8,9,10,-1,-1,-1,30,31,32,35,36,-1,-1,-1,-1,72,73,77,75,-1,-1,-1,-1,78,103,102,97,-1,-1,114,115,131,139,140,119,-1,-1,158,159,176,186,187,188,189,-1,214,-1,239,240,244,245,246,-1,-1,-1,265,266,282,283,284}}
player_alt_idle_big26={width=8,unique=42,total=64,spriteIDs={-1,-1,6,7,8,9,10,-1,-1,-1,30,31,32,33,34,-1,-1,-1,-1,72,73,76,75,-1,-1,-1,-1,78,88,98,97,-1,-1,114,115,131,132,133,119,-1,-1,158,159,176,177,190,191,189,-1,214,-1,239,240,247,248,246,-1,-1,-1,265,266,282,283,284}}
player_alt_idle_big27={width=8,unique=41,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,17,18,19,20,21,-1,-1,-1,47,48,62,67,51,-1,-1,-1,-1,78,88,89,90,-1,-1,114,115,116,117,118,119,-1,-1,158,159,160,161,162,163,164,-1,214,-1,215,216,217,218,219,-1,-1,-1,265,266,267,268,269}}
player_alt_idle_big28={width=8,unique=41,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,17,18,19,20,21,-1,-1,-1,47,48,62,67,51,-1,-1,-1,-1,78,88,89,90,-1,-1,114,115,116,117,118,119,-1,-1,158,159,160,161,192,193,185,-1,214,-1,215,216,249,242,243,-1,-1,-1,265,266,279,280,281}}

player_flick_big2={width=8,unique=41,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,27,28,29,20,21,-1,-1,-1,68,69,70,50,51,-1,-1,-1,-1,78,88,89,90,-1,-1,114,115,116,117,118,119,-1,-1,158,159,160,161,162,163,164,-1,214,-1,215,216,217,218,219,-1,-1,-1,265,266,267,268,269}}

player_idle_big21={width=8,unique=41,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,17,18,19,20,21,-1,-1,-1,47,48,49,50,51,-1,-1,-1,-1,78,88,89,90,-1,-1,114,115,116,117,118,119,-1,-1,158,159,160,161,162,163,164,-1,214,-1,215,216,217,218,219,-1,-1,-1,265,266,267,268,269}}
player_idle_big22={width=8,unique=40,total=64,spriteIDs={-1,-1,-1,-1,3,4,5,-1,-1,-1,22,23,24,25,26,-1,-1,-1,52,53,54,55,56,-1,-1,-1,-1,-1,91,92,93,-1,-1,114,115,120,121,118,122,-1,-1,158,159,165,166,167,163,164,-1,214,-1,220,221,222,218,219,-1,-1,-1,265,266,267,268,269}}
player_idle_big23={width=8,unique=40,total=64,spriteIDs={-1,-1,-1,-1,3,4,5,-1,-1,-1,22,23,24,25,26,-1,-1,-1,52,53,57,58,59,-1,-1,-1,-1,-1,94,95,93,-1,-1,123,124,125,126,127,128,-1,-1,168,169,170,171,172,173,174,-1,223,-1,224,225,226,227,228,-1,-1,-1,265,266,270,271,272}}
player_idle_big24={width=8,unique=40,total=64,spriteIDs={-1,-1,-1,-1,3,4,5,-1,-1,-1,22,23,24,25,26,-1,-1,-1,52,53,57,58,59,-1,-1,-1,-1,-1,94,95,93,-1,-1,123,124,125,126,127,128,-1,-1,168,169,170,171,172,173,174,-1,223,-1,224,225,229,230,231,-1,-1,-1,265,266,273,274,275}}
player_idle_big25={width=8,unique=40,total=64,spriteIDs={-1,-1,-1,-1,3,4,5,-1,-1,-1,22,23,24,25,26,-1,-1,-1,52,53,54,60,61,-1,-1,-1,-1,-1,91,92,93,-1,-1,123,124,129,121,118,130,-1,-1,168,169,175,166,167,163,164,-1,223,-1,232,221,233,234,235,-1,-1,-1,265,266,273,274,275}}
player_idle_big26={width=8,unique=41,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,17,18,19,20,21,-1,-1,-1,47,48,62,63,64,-1,-1,-1,-1,78,88,96,97,-1,-1,114,115,116,117,118,119,-1,-1,158,159,160,161,162,163,164,-1,214,-1,215,216,217,218,219,-1,-1,-1,265,266,267,268,269}}
player_idle_big27={width=8,unique=41,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,17,18,19,20,21,-1,-1,-1,47,48,62,65,66,-1,-1,-1,-1,78,88,89,90,-1,-1,114,115,116,117,118,119,-1,-1,158,159,160,161,162,163,164,-1,214,-1,215,216,236,237,238,-1,-1,-1,265,266,276,277,278}}
player_idle_big28={width=8,unique=41,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,17,18,19,20,21,-1,-1,-1,47,48,62,67,51,-1,-1,-1,-1,78,88,89,90,-1,-1,114,115,116,117,118,119,-1,-1,158,159,160,161,162,163,164,-1,214,-1,215,216,217,218,219,-1,-1,-1,265,266,267,268,269}}

player_walk_big21={width=8,unique=41,total=64,spriteIDs={-1,-1,-1,-1,11,12,13,-1,-1,-1,37,38,39,40,41,-1,-1,-1,78,79,80,81,82,-1,-1,-1,-1,104,105,106,107,-1,141,142,143,144,145,146,147,-1,194,195,196,197,198,199,200,201,-1,-1,-1,250,251,252,253,254,-1,-1,-1,-1,285,286,287,288}}
player_walk_big22={width=8,unique=40,total=64,spriteIDs={-1,-1,-1,7,14,15,16,-1,-1,-1,42,43,44,45,46,-1,-1,-1,-1,83,84,85,86,-1,-1,-1,-1,108,109,110,111,-1,148,149,150,151,152,153,154,-1,202,-1,203,204,205,206,207,208,-1,-1,-1,239,255,256,257,258,-1,-1,-1,-1,289,290,291,292}}
player_walk_big23={width=8,unique=41,total=64,spriteIDs={-1,-1,-1,-1,11,12,13,-1,-1,-1,37,38,39,40,41,-1,-1,-1,78,79,80,81,82,-1,-1,-1,-1,104,112,113,107,-1,141,142,143,144,155,156,157,-1,194,195,196,197,209,210,211,201,-1,-1,-1,250,259,260,261,254,-1,-1,-1,-1,293,294,295,288}}
player_walk_big24={width=8,unique=40,total=64,spriteIDs={-1,-1,-1,7,14,15,16,-1,-1,-1,42,43,44,45,46,-1,-1,-1,-1,83,84,87,86,-1,-1,-1,-1,108,109,110,111,-1,148,149,150,151,152,153,154,-1,202,-1,203,204,212,213,207,208,-1,-1,-1,239,262,263,264,258,-1,-1,-1,-1,296,297,291,292}}
-- spritelib-end

-- loop animation

-- idles version of swell udder. need to find a way to animate them.
-- normal idle that will happen once a while.

local delay = 0
local frame = 1
local time = 0

local idle_big2 = {

    [player_idle_big21] = {
    delay = 0,
    frame = 1,
    time = 5000
    },

    [player_idle_big22] = {
    delay = 0,
    frame = 1,
    time = 100
    },

    [player_idle_big23] = {
    delay = 0,
    frame = 1,
    time = 160
    },

    [player_idle_big24] = {
    delay = 0,
    frame = 1,
    time = 400
    },

    [player_idle_big25] = {
    delay = 0,
    frame = 1,
    time = 80
    },


    [player_idle_big26] = {
    delay = 0,
    frame = 1,
    time = 100
    },


    [player_idle_big27] = {
    delay = 0,
    frame = 1,
    time = 100},


    [player_idle_big28] = {
    delay = 0,
    frame = 1,
    time = 80
    }


}

--[[
    Pixel Vision 8 - New Template Script
    Copyright (C) 2017, Pixel Vision 8 (http://pixelvision8.com)
    Created by Jesse Freeman (@jessefreeman)

    This project was designed to display some basic instructions when you create
    a new game.    Simply delete the following code and implement your own Init(),
    Update() and Draw() logic.

    Learn more about making Pixel Vision 8 games at https://www.gitbook.com/@pixelvision8
]]--

-- This this is an empty game, we will the following text. We combined two sets of fonts into
-- the default.font.png. Use uppercase for larger characters and lowercase for a smaller one.
local title = "Momoo Games"
local message = "this is an empty game template. press ctrl + 1 to open the editor or use an external editor to modify the files found in your workspace game folder."


local Up, Down, Right, Left, A, B, Select, Start = 0, 1, 2, 3, 4, 5, 6, 7

-- The Init() method is part of the game's lifecycle and called a game starts. We are going to
-- use this method to configure background color, ScreenBufferChip and draw a text box.
function Init()
    -- Here we are manually changing the background color
    apiBridge:ChangeBackgroundColor(64)
    -- We are going to render text into the ScreenBuffer so need to rebuild it first.
    apiBridge:RebuildScreenBuffer()
    -- We are going to render some text in a box to the ScreenBuffer.
    apiBridge:DrawTextBoxToBuffer(message, 60, 1, 26, "default", -4, true)
end

-- The Update() method is part of the game's life cycle. The engine calls Update() on every frame
-- before the Draw() method. It accepts one argument, timeDelta, which is the difference in
-- milliseconds since the last frame.

function Update(timeDelta)

    -- Here we'll determine when it's time to change the sprite frame.
    if(time > 0.09) then
        -- If time is past the frame we'll increase the frame number to advance the animation.
        idle_big2.frame = frame + 1

        -- We need to reset the frame number if it is greater than the number of frames.
        if(frame > idle_big2) then
            idle_big2.frame = 1
        end
        -- Now we can reset time back to 0 to start tracking the next frame change.
        time = 0
    end

end

-- The Draw() method is part of the game's life cycle. It is called after Update() and is where
-- all of our draw calls should go. We'll be using this to render sprites to the display.

function Draw()
    -- Since we are using the ScreenBuffer, we can use this to clear the display.
    apiBridge:DrawScreenBuffer()
    -- Let's draw the title as sprites on each frame
    apiBridge:DrawFont(title, 8, 192, "default", 0, 0)
end

local spriteData = idle_big2 [50000]

if(spriteData ~= nil) then
    apiBridge:DrawSprites(spriteData.spriteIDs, 0, 0, spriteData.width, false, false, true, 0)
end

i think the problem come from the different local "time" and "frame" but not on idle_big2... i might probably missed something...

ah yes, i forgot to mention in the first post that my short game will be a point and click sort of puzzle game. since the character is looking for the missing parts of her machine to milk out of her swell udder.

It looks like there are several problems in your code. The first is that you don't define time which is used in the update method. That would probably throw an error assuming it makes it that far. The error says line 177 but when I look at the code outside of this post it doesn't match up to a line of code. My suggestion would be to take a step back and walk through how the other demos are built and use animation, especially with larger sprites. Once you get a handle on that, slowly start adding your own code in and see what happens. I also noticed you put the draw logic at the bottom of the script but it's not inside of the Draw method and your call to idle_big2 [50000] is out of the range of the table so that will fail too.

alright, i managed to fix every errors but i still can't find any clue why it's still displayed blank...

-- spritelib-start
-- idle cycle of the swell udder version.
player_idle_big21={time=500,width=8,unique=41,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,17,18,19,20,21,-1,-1,-1,47,48,49,50,51,-1,-1,-1,-1,78,87,88,89,-1,-1,113,114,115,116,117,118,-1,-1,157,158,159,160,161,162,163,-1,213,-1,214,215,216,217,218,-1,-1,-1,264,265,266,267,268}}
player_idle_big22={time=100,width=8,unique=40,total=64,spriteIDs={-1,-1,-1,-1,3,4,5,-1,-1,-1,22,23,24,25,26,-1,-1,-1,52,53,54,55,56,-1,-1,-1,-1,-1,90,91,92,-1,-1,113,114,119,120,117,121,-1,-1,157,158,164,165,166,162,163,-1,213,-1,219,220,221,217,218,-1,-1,-1,264,265,266,267,268}}
player_idle_big23={time=160,width=8,unique=40,total=64,spriteIDs={-1,-1,-1,-1,3,4,5,-1,-1,-1,22,23,24,25,26,-1,-1,-1,52,53,57,58,59,-1,-1,-1,-1,-1,93,94,92,-1,-1,122,123,124,125,126,127,-1,-1,167,168,169,170,171,172,173,-1,222,-1,223,224,225,226,227,-1,-1,-1,264,265,269,270,271}}
player_idle_big24={time=400,width=8,unique=40,total=64,spriteIDs={-1,-1,-1,-1,3,4,5,-1,-1,-1,22,23,24,25,26,-1,-1,-1,52,53,57,58,59,-1,-1,-1,-1,-1,93,94,92,-1,-1,122,123,124,125,126,127,-1,-1,167,168,169,170,171,172,173,-1,222,-1,223,224,228,229,230,-1,-1,-1,264,265,272,273,274}}
player_idle_big25={time=80,width=8,unique=40,total=64,spriteIDs={-1,-1,-1,-1,3,4,5,-1,-1,-1,22,23,24,25,26,-1,-1,-1,52,53,54,60,61,-1,-1,-1,-1,-1,90,91,92,-1,-1,122,123,128,120,117,129,-1,-1,167,168,174,165,166,162,163,-1,222,-1,231,220,232,233,234,-1,-1,-1,264,265,272,273,274}}
player_idle_big26={time=100,width=8,unique=41,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,17,18,19,20,21,-1,-1,-1,47,48,62,63,64,-1,-1,-1,-1,78,87,95,96,-1,-1,113,114,115,116,117,118,-1,-1,157,158,159,160,161,162,163,-1,213,-1,214,215,216,217,218,-1,-1,-1,264,265,266,267,268}}
player_idle_big27={time=100,width=8,unique=41,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,17,18,19,20,21,-1,-1,-1,47,48,62,65,66,-1,-1,-1,-1,78,87,88,89,-1,-1,113,114,115,116,117,118,-1,-1,157,158,159,160,161,162,163,-1,213,-1,214,215,235,236,237,-1,-1,-1,264,265,275,276,277}}
player_idle_big28={time=80,width=8,unique=41,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,17,18,19,20,21,-1,-1,-1,47,48,62,67,51,-1,-1,-1,-1,78,87,88,89,-1,-1,113,114,115,116,117,118,-1,-1,157,158,159,160,161,162,163,-1,213,-1,214,215,216,217,218,-1,-1,-1,264,265,266,267,268}}
-- spritelib-end

-- mode enums
local Up, Down, Right, Left, A, B, Select, Start = 0, 1, 2, 3, 4, 5, 6, 7

-- animation data
local player = {
    delay = 0,
    frame = 1,
    time = .2,
    total = 8,
    frames=
    {player_idle_big21,
    player_idle_big22,
    player_idle_big23,
    player_idle_big24,
    player_idle_big25,
    player_idle_big26,
    player_idle_big27,
    player_idle_big28}
}

-- The Init() method is part of the game's lifecycle and called a game starts. We are going to
-- use this method to configure background color, ScreenBufferChip and draw a text box.
function Init()

    -- Here we are manually changing the background color
    apiBridge:ChangeBackgroundColor(64)

    -- We are going to render text into the ScreenBuffer so need to rebuild it first.
    apiBridge:RebuildScreenBuffer()

end

-- The Update() method is part of the game's life cycle. The engine calls Update() on every frame
-- before the Draw() method. It accepts one argument, timeDelta, which is the difference in
-- milliseconds since the last frame.
function Update(timeDelta)

    -- update animation timer
    player.delay = player.delay + timeDelta

    -- see if we should change animation
    if(player.delay > player.time) then

        -- reset the delay
        player.delay = 0

        -- update the current frame
        player.frame = player.frame + 1

        -- make sure we reset the frame counter when out of anim.frames
        if(player.frame > player.total) then
            player.frame = 1
        end
    end

end

-- The Draw() method is part of the game's life cycle. It is called after Update() and is where
-- all of our draw calls should go. We'll be using this to render sprites to the display.
function Draw()

-- Since we are using the ScreenBuffer, we can use this to clear the display
    apiBridge:DrawScreenBuffer()

local spriteData = player [frame]

    if(spriteData ~= nil) then
       apiBridge:DrawSprites(player[1], 20, 70, false, false, true, 0)
    end
end

i'm starting to wonder if it wasn't because of the player array is the problem

well, that aside, i will continue it for later, i will start cleaning up my sprites as well working on my rooms.

one question though: how can i set up my sprite as 2x2 instead of 8x8?

It still looks like you are not referencing the correct frames table. Try chnaging the spriteData and draw call to this:

local spriteData = player.frames[frame]


if(spriteData ~= nil) then
   apiBridge:DrawSprites(spriteData.spriteIDs, 20, 70, spriteData.width, false, false, true, 0)
end

Just thinking off the top of my head but if you are having trouble still, you can always just test manually setting the spriteData to make sure you are getting the correct frame, the replace that value with the frame value which is incremented in the Updat() call. Likewise you can try to use print("What frame are we on" .. frame) and watch the log.txt file or use the debugger to make sure you are getting the right numbers. Lua is a bit frustrating in that you can reference varibles that don't exist and you just get nil without an error. That's why I check for spriteData to not be nil before trying to draw. You just need to focus on getting the correct value for spriteData.