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

momoo short game [WIP]

A topic by allaze-eroler created 155 days ago Views: 839 Replies: 15
Viewing posts 1 to 9

hello folks, i figured that i should share my progress done with my short game, i hope it will be part of demos but for now, it's a very early version of the game.


first of all, here the current progress of sprites:


and the animation of the full idle which i'm trying to achieve as result:


and here the result of my game that i managed so far:


then the code source i have so far and i know it's messy:

-- 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 that i'm still figuring out how to make it work

--[[
local idle_big2 = {
    [player_idle_big21],
    [player_idle_big22],
    [player_idle_big23],
    [player_idle_big24],
    [player_idle_big25],
    [player_idle_big26],
    [player_idle_big27],
    [player_idle_big28],
}
]]--

--[[
    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."

--player momoo:
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)
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)
    apiBridge:DrawSprites(player_idle_big21.spriteIDs, 0, 0, player_idle_big21.width, false, false, true, 0)
end

as you might noticed, i'm still trying to figure out how to make the larger sprite animated, do you have any suggestion to make it work?

let hope it will work! :D

I would suggest looking at the Draw Sprite Demo which you can also fine online here. It looks like you are on the right path with your idle_big2 array. Check out the demo and how I increment the frame number on line 69 - 85. Once you sync up the frame to the update method, you can simply pass that frame value in to pull out the right sprites from the idle_big2 array in your draw method. I'd replace your last DrawSprites call with something like this:

local spriteData = idle_big2 [frame]

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

I used this a lot in the tools and some of the other demos like RPG8. Basically you are trying to get a reference to the sprite data the Sprite Builder generated but you always want to test to see if that data exists.

One thing to note is that your graphic is really large, especially for an 8-bit system. Looks like it contains 64 sprites so you will run into an issue where there is no more memory for additional sprites. I'd suggest using smaller sprites like 2x2 or 2x3 which were common on older systems and leave you enough sprites to animate other elements. You can increase the draw calls in the Display Tool but Game Creator caps it at 96.

(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.

(Edited 1 time)

finally, i fixed the problem with the animation! apparently, the problem was because of that line of code:

local spriteData = anim.frames[frame]
if(spriteData ~= nil) then
   apiBridge:DrawSprites(spriteData.spriteIDs, 20, 70, spriteData.width, false, false, true, 0)
end

but actually, i should have used this way:

local spriteData = anim.frames[anim.frame]
if(spriteData ~= nil) then
   apiBridge:DrawSprites(spriteData.spriteIDs, 20, 70, spriteData.width, false, false, true, 0)
end

no wonder why i haven't though of adding that kind of information...

alright! now, here the result i managed to get so far:


ok, now it's time to figure out how to give each frame a precise timing, let me explain: for example, the first frame will stay for let said 10 seconds the rest of frames will have different time to give some dynamism. for now, i have though of this code:

-- animation data

local anim = {
   delay = 0,
   frame = 1,
   time = 5,0.1,0.16,0.4,0.8,0.1,0.1,0.8,
   total = 8,
   frames=
      {player_idle_big11,player_idle_big12,player_idle_big13,player_idle_big14,player_idle_big15,player_idle_big16,player_idle_big17,player_idle_big18},
      {player_idle_big21,player_idle_big22,player_idle_big23,player_idle_big24,player_idle_big25,player_idle_big26,player_idle_big27,player_idle_big28},
      {player_idle_big11,player_flick_big1},
      {player_idle_big21,player_flick_big2},
      {player_alt_idle_big11,player_alt_idle_big12,player_alt_idle_big13,player_alt_idle_big14,player_alt_idle_big15,player_alt_idle_big16,player_alt_idle_big17,player_alt_idle_big18},
      {player_alt_idle_big21,player_alt_idle_big22,player_alt_idle_big23,player_alt_idle_big24,player_alt_idle_big25,player_alt_idle_big26,player_alt_idle_big27,player_alt_idle_big28}
}

and apparently, it didn't worked like i hoped.

also, you might noticed that i switched "player" to "anim" because i found out that these animation loop is much adapted for "anim" rather than "player. i will add the randomizer for the idle, the flick, and the alternate idle for later. and once all of them is done, i will try to add the input on the character.

(Edited 2 times)

alright! now that the PV8 update is finally here, the new features are wonderful but that doesn't solve the problem i have.


here how it will happen when i use the current code as result:


as you can see, it's not what i'm trying to achieve, here what is the goal i wanted the game display:

as you can see, the duration of each frame are dynamic which it's exactly what i'm trying to achieve. do you know what is the right methode to achieve it?

i will upload the code source once i finish cleaning them all from the old api to the new api.

alright, i just finished cleaning my code source and added the mouse features that worked pretty well but not yet fixed the sprite part of character... i always get that message: 

"IndexOutOfRangeException:
Array index is out of range."

wondering why it happened even though i did them right... might have something about the last part of code. allright, here the code source:

-- spritelib-start
-- idle cycle of normal udder and clothed edition.
MomooIdleN2_1={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,15,16,17,18,19,-1,-1,-1,45,46,91,92,49,-1,-1,-1,-1,-1,112,113,114,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
MomooIdleN2_2={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,3,4,5,-1,-1,-1,20,21,22,23,24,-1,-1,-1,50,51,93,94,54,-1,-1,-1,-1,-1,115,116,117,-1,-1,158,159,164,226,227,228,-1,-1,235,236,242,243,324,325,326,-1,-1,-1,270,353,431,429,432,-1,-1,-1,-1,452,489,490,-1}}
MomooIdleN2_3={width=8,unique=36,total=64,spriteIDs={-1,-1,-1,-1,3,4,5,-1,-1,-1,20,21,22,25,24,-1,-1,-1,50,51,95,96,57,-1,-1,-1,-1,-1,118,119,117,-1,-1,167,168,169,229,227,230,-1,-1,245,246,247,248,327,328,329,-1,-1,-1,355,356,433,434,-1,-1,-1,-1,-1,452,489,490,-1}}
MomooIdleN2_4={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,3,4,5,-1,-1,-1,20,21,22,23,24,-1,-1,-1,50,51,93,97,59,-1,-1,-1,-1,-1,115,116,117,-1,-1,158,159,164,226,227,228,-1,-1,235,236,242,243,324,325,326,-1,-1,-1,270,353,431,429,432,-1,-1,-1,-1,452,489,490,-1}}
MomooIdleN2_5={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,15,16,17,18,19,-1,-1,-1,45,46,91,98,61,-1,-1,-1,-1,-1,112,120,121,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
MomooIdleN2_6={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,15,16,17,18,19,-1,-1,-1,45,46,91,99,63,-1,-1,-1,-1,-1,112,113,114,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
MomooIdleN2_7={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,15,16,17,18,19,-1,-1,-1,45,46,91,100,49,-1,-1,-1,-1,-1,112,113,114,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
-- spritelib-end
-- mode enums
local Up, Down, Right, Left, A, B, Select, Start = 0, 1, 2, 3, 4, 5, 6, 7
    local MomooIdleNormal2Sprites = {
            MomooIdleN2_1[1],
            MomooIdleN2_2[1],
            MomooIdleN2_3[1],
            MomooIdleN2_4[1],
            MomooIdleN2_5[1],
            MomooIdleN2_6[1],
            MomooIdleN2_7[1],
            MomooIdleN2_8[1]}
local idleNormal2Animation = {
    {sprite = MomooIdleNormal2Sprites[1], hFlip = false, vFlip = false, time = 2},
    {sprite = MomooIdleNormal2Sprites[2], hFlip = false, vFlip = false, time = .1},
    {sprite = MomooIdleNormal2Sprites[3], hFlip = false, vFlip = false, time = .16},
    {sprite = MomooIdleNormal2Sprites[4], hFlip = false, vFlip = false, time = .4},
    {sprite = MomooIdleNormal2Sprites[5], hFlip = false, vFlip = false, time = .08},
    {sprite = MomooIdleNormal2Sprites[6], hFlip = false, vFlip = false, time = .1},
    {sprite = MomooIdleNormal2Sprites[7], hFlip = false, vFlip = false, time = .1},
    {sprite = MomooIdleNormal2Sprites[8], hFlip = false, vFlip = false, time = .08}
}
-- Here we will store the random idle animation data
local idleDelay = .2
local idleTime = 0
local idleFrame = 1
-- The Mouse Demo shows off how to capture mouse input and display a cursor on the screen.
-- Pixel Vision 8 requires the runner to supply mouse data via the ControllerChip.You will
-- need to implement the IMouseInput interface and register a custom Mouse Class with the
-- ControllerChip in order for this demo to work.
-- We need to create some fields to store the mouse cursor's sprites, dimensions, position, and offset.
local greenCursorSprites = {0493,0494,0495,0496}
local redCursorSprites = {0497,0498,0499,0500}
local greyCursorSprites = {0501,0502,0503,0504}
local handCursorSprites = {0505,0506,0507,0508}
local eyeCursorSprites ={0509,0510,0511,0512}
local crossCursorSprites ={0513,0514,0515,0516}
local cursorWidth = 2
local fontOffsetX = 128
local mousePos = {x = -1, y = 0}
-- 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()
    -- Before we start, we need to set a background color and rebuild the ScreenBufferChip. The screen buffer
    -- allows us to draw our fonts into the background layer to save on draw calls.
    BackgroundColor(31)
    DrawText("momoo game test Demo", 1, 1, DrawMode.Tile, "default")
    -- This default text will help display the current state of the mouse. We'll render it into the
    -- ScreenBufferChip to cut down on sprite draw calls.
    DrawText("MOUSE POSITION", 1, 1, DrawMode.Tile, "large-font", 0);
    DrawText("BUTTON 1 DOWN", 1, 3, DrawMode.Tile, "large-font", 0);
    DrawText("BUTTON 2 DOWN", 1, 4, DrawMode.Tile, "large-font", 0);
    local pipeX = 1
    local pipeY = 21
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)
    -- The APIBridge exposes a property for the mouse's x and y position. We'll store this in a field and
    -- retrieve it during Draw() execution of the GameChip's life cycle.
    mousePos = MousePosition()
    -- While this step may appear to be wasteful, it's important to separate any calculation logic from
    -- render logic. This optimization technique will ensure the best performance for Pixel Vision 8 games
    -- and free up the Draw() method to only focus on rendering.
    -- Here we are tracking the fireball animation
    idleTime = idleTime + timeDelta
    if(idleTime > idleDelay) then
        idleFrame = idleFrame + 1
        if(idleFrame > #idleNormal2Animation) then
             idleFrame = 1
        end
        idleTime = 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()
    -- We can use the DrawScreenBuffer() method to clear the screen and redraw the tilemap in a
    -- single call.
    Clear()
    DrawTilemap(0, 0, 32, 30)
    -- We can use the RedrawDisplay() method to clear the screen and redraw the tilemap in a
    -- single call.
    RedrawDisplay()
    -- For the last bit of code we are just going to display whether the left or right mouse button is being held down by using the
    -- GetMouseButton() method on the APIBridge.
    DrawText(tostring(MouseButton(0)):upper(), fontOffsetX - 8, 24, DrawMode.Sprite, "large-font", 0)
    DrawText(tostring(MouseButton(1)):upper(), fontOffsetX - 8, 32, DrawMode.Sprite, "large-font", 0)
    -- We are going to detect if the mouse is on the screen. When the cursor is within the bounds
    -- of the DisplayChip, we will show its x and y position.
    if (mousePos.x < 0 or mousePos.y < 0) then
        DrawText("OFFSCREEN", fontOffsetX, 8, DrawMode.Sprite, "large-font", 0)
    else
        -- Pixel Vision 8 automatically returns a -1 value for the mouse x and y position if it is out of the bounds of the DisplayChip
        -- or if a mouse was is not registered with the ControllerChip.
        -- Since the mouse within the display, let's show its current x and y position.
        DrawText("(" ..  mousePos.x .. "," .. mousePos.y .. ")", fontOffsetX, 8, DrawMode.Sprite, "large-font", 0)
        -- We also need to draw it to the display. We'll be using the DrawSprites() method to take the four cursor sprites and render them in a 2 x 2 grid.
        DrawSprites(greenCursorSprites, mousePos.x, mousePos.y, cursorWidth)
    end
    local newX = 8
    local newY = 48
    local frameData = idleNormal2Animation[idleFrame]
    newX = newX + 16
    DrawSprite(frameData.sprite, newX, newY, frameData.hFlip, frameData.vFlip) --frameData.time)
end

to be honest, this new api is really more elegant and cleaner than the old version which i'm very happy of the result! :) too bad that last portion of code is bugging me for a while now XD;

something tell me that out of range exception might be a bug from your new api, i tried everything and i even used your DrawSpriteDemo as a base and bring my spriteIDS i made with sprite builder in the place of fireball's SpriteIDs. it still said out of range.

i suppose it was because my sprites is larger than 8x8? since it's a 64x64 as sprite size.

In case anyone else is following the thread, I looked at the code you sent me and cleaned it up. The big thing you want to do is change the frame delay every time you reset the timer.

idleTime = idleTime + timeDelta
if(idleTime > idleDelay) then
    idleFrame = idleFrame + 1
    if(idleFrame > #idleFrames) then
         idleFrame = 1
    end     idleDelay = idleFrames[idleFrame].time
    idleTime = 0
    
    end
end

Also, for the index errors, I double checked the drawing API and the issue looks like how you are formatting the tables. One thing that is not happening though are the error messages showing the correct line. I'll look into ways to make that clearer so you can debug it a bit easier.

(Edited 1 time)

as pixel explained it, it was my fault for not double checking the array tables... and the "function update(timeDelta)" that pixel provided for me greatly helped me to get the right timing for each frame! many thank to him! :D

alright, now that i fixed most of stuff, here the current code source i made so far:

-- still sprite of normal udder and clothed edition.
MomooStillN2={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,15,16,17,18,19,-1,-1,-1,45,46,91,92,49,-1,-1,-1,-1,-1,112,113,114,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
-- flick cycle of normal udder and clothed edition.
MomooFlickN2={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,26,27,28,18,19,-1,-1,-1,65,66,101,92,49,-1,-1,-1,-1,-1,112,113,114,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
-- idle cycle of normal udder and clothed edition.
MomooIdleN2_2={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,3,4,5,-1,-1,-1,20,21,22,23,24,-1,-1,-1,50,51,93,94,54,-1,-1,-1,-1,-1,115,116,117,-1,-1,158,159,164,226,227,228,-1,-1,235,236,242,243,324,325,326,-1,-1,-1,270,353,431,429,432,-1,-1,-1,-1,452,489,490,-1}}
MomooIdleN2_3={width=8,unique=36,total=64,spriteIDs={-1,-1,-1,-1,3,4,5,-1,-1,-1,20,21,22,25,24,-1,-1,-1,50,51,95,96,57,-1,-1,-1,-1,-1,118,119,117,-1,-1,167,168,169,229,227,230,-1,-1,245,246,247,248,327,328,329,-1,-1,-1,355,356,433,434,-1,-1,-1,-1,-1,452,489,490,-1}}
MomooIdleN2_4={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,3,4,5,-1,-1,-1,20,21,22,23,24,-1,-1,-1,50,51,93,97,59,-1,-1,-1,-1,-1,115,116,117,-1,-1,158,159,164,226,227,228,-1,-1,235,236,242,243,324,325,326,-1,-1,-1,270,353,431,429,432,-1,-1,-1,-1,452,489,490,-1}}
MomooIdleN2_5={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,15,16,17,18,19,-1,-1,-1,45,46,91,98,61,-1,-1,-1,-1,-1,112,120,121,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
MomooIdleN2_6={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,15,16,17,18,19,-1,-1,-1,45,46,91,99,63,-1,-1,-1,-1,-1,112,113,114,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
MomooIdleN2_7={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,15,16,17,18,19,-1,-1,-1,45,46,91,100,49,-1,-1,-1,-1,-1,112,113,114,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
-- speaking cycle of normal udder and clothed edition.
MomooSpeakingN2_1={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,15,16,17,18,19,-1,-1,-1,45,46,91,102,49,-1,-1,-1,-1,-1,112,113,114,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
MomooSpeakingN2_2={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,15,16,17,18,19,-1,-1,-1,45,46,91,103,49,-1,-1,-1,-1,-1,112,120,114,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
MomooSpeakingN2_3={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,15,16,17,18,19,-1,-1,-1,45,46,91,104,49,-1,-1,-1,-1,-1,112,120,114,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
MomooSpeakingN2_4={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,15,16,17,18,19,-1,-1,-1,45,46,91,105,49,-1,-1,-1,-1,-1,112,113,114,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
MomooSpeakingN2_5={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,15,16,17,18,19,-1,-1,-1,45,46,91,106,49,-1,-1,-1,-1,-1,112,113,114,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
MomooSpeakingN2_6={width=8,unique=37,total=64,spriteIDs={-1,-1,-1,-1,0,1,2,-1,-1,-1,15,16,17,18,19,-1,-1,-1,45,46,91,102,49,-1,-1,-1,-1,-1,112,113,114,-1,-1,158,159,160,161,224,225,-1,-1,235,236,237,238,321,322,323,-1,-1,-1,348,349,428,429,430,-1,-1,-1,-1,452,489,490,-1}}
-- still sprite of normal udder and clothed edition.
local StillNormal2 = {
    {spriteData = MomooStillN2, time = 5}
}
-- Here we will store the random idle animation data.
-- the idle cycle of normal udder and clothed edition.
local idleNormal2Frames = {
    {spriteData = MomooIdleN2_1, time = .1},
    {spriteData = MomooIdleN2_2, time = .56},
    {spriteData = MomooIdleN2_3, time = .08},
    {spriteData = MomooIdleN2_4, time = .1},
    {spriteData = MomooIdleN2_5, time = .1},
    {spriteData = MomooIdleN2_6, time = .08}
}
-- flick cycle of normal udder and clothed edition.
local FlickNormal2 = {
    {spriteData = MomooFlickN2, time = .05}
}
-- The speaking cycle of normal udder and clothed edition.
local speakingNormal2Frames = {
    {spriteData = MomooSpeakingN2_1, time = .12},
    {spriteData = MomooSpeakingN2_2, time = .12},
    {spriteData = MomooSpeakingN2_3, time = .12},
    {spriteData = MomooSpeakingN2_4, time = .12},
    {spriteData = MomooSpeakingN2_5, time = .12},
    {spriteData = MomooSpeakingN2_6, time = .12}
}
-- these different local will be used for timing of each frame.
local idleDelay = .2
local idleTime = 0
local idleFrame = 1
-- The Mouse Demo shows off how to capture mouse input and display a cursor on the screen.
-- Pixel Vision 8 requires the runner to supply mouse data via the ControllerChip.You will
-- need to implement the IMouseInput interface and register a custom Mouse Class with the
-- ControllerChip in order for this demo to work.
-- We need to create some fields to store the mouse cursor's sprites, dimensions, position, and offset.
local greenCursorSprites = {0493,0494,0495,0496}
local redCursorSprites = {0497,0498,0499,0500}
local greyCursorSprites = {0501,0502,0503,0504}
local handCursorSprites = {0505,0506,0507,0508}
local eyeCursorSprites ={0509,0510,0511,0512}
local crossCursorSprites ={0513,0514,0515,0516}
local cursorWidth = 2
local fontOffsetX = 128
local mousePos = {x = -1, y = 0}
-- 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()
-- Before we start, we need to set a background color and rebuild the ScreenBufferChip. The screen buffer
-- allows us to draw our fonts into the background layer to save on draw calls.
    BackgroundColor(31)
    DrawText("momoo game test Demo", 1, 1, DrawMode.Tile, "default")
-- This default text will help display the current state of the mouse. We'll render it into the
-- ScreenBufferChip to cut down on sprite draw calls.
--DrawText("MOUSE POSITION", 1, 1, DrawMode.Tile, "large-font", 0);
--DrawText("BUTTON 1 DOWN", 1, 3, DrawMode.Tile, "large-font", 0);
--DrawText("BUTTON 2 DOWN", 1, 4, DrawMode.Tile, "large-font", 0);
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)
-- The APIBridge exposes a property for the mouse's x and y position. We'll store this in a field and
-- retrieve it during Draw() execution of the GameChip's life cycle.
    mousePos = MousePosition()
-- While this step may appear to be wasteful, it's important to separate any calculation logic from
-- render logic. This optimization technique will ensure the best performance for Pixel Vision 8 games
-- and free up the Draw() method to only focus on rendering.
-- Here we are tracking the each iddles animation features.
    idleTime = idleTime + timeDelta
    if(idleTime > idleDelay) then
        idleFrame = idleFrame + 1
        if(idleFrame > #idleNormal2Frames) then
             idleFrame = 1
        end
        idleDelay = idleNormal2Frames[idleFrame].time
        idleTime = 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()
    RedrawDisplay()
-- For the last bit of code we are just going to display whether the left or right mouse button is being held down by using the
-- GetMouseButton() method on the APIBridge.
    --[[DrawText(tostring(MouseButton(0)):upper(), fontOffsetX - 8, 24, DrawMode.Sprite, "large-font", 0)
    DrawText(tostring(MouseButton(1)):upper(), fontOffsetX - 8, 32, DrawMode.Sprite, "large-font", 0)
    ]]
-- character position starter.
    local newX = 8
    local newY = 128
--that line of code will tell where to get the sprite data. so, the game will be able to animate them.
    local frameData = idleNormal2Frames[idleFrame]
-- that little "if(frameData ~= nil) then" is REALLY important to add. so, it will not display "out of the range"
-- everytime i start the game.
-- each variable will be called from the array code at the start of file.
    if(frameData ~= nil) then
        DrawSprites(frameData.spriteData.spriteIDs, newX, newY, frameData.spriteData.width)
    end
-- We are going to detect if the mouse is on the screen. When the cursor is within the bounds
-- of the DisplayChip, we will show its x and y position.
    if (mousePos.x < 0 or mousePos.y < 0) then
        --[[ DrawText("OFFSCREEN", fontOffsetX, 8, DrawMode.Sprite, "large-font", 0)
        ]]
    else
-- Pixel Vision 8 automatically returns a -1 value for the mouse x and y position if it is out of the bounds of the DisplayChip
-- or if a mouse was is not registered with the ControllerChip.
-- Since the mouse within the display, let's show its current x and y position.
        --[[ DrawText("(" ..  mousePos.x .. "," .. mousePos.y .. ")", fontOffsetX, 8, DrawMode.Sprite, "large-font", 0)
        ]]
-- We also need to draw it to the display. We'll be using the DrawSprites() method to take the four cursor sprites and render them in a 2 x 2 grid.
        DrawSprites(greenCursorSprites, mousePos.x, mousePos.y, cursorWidth)
    end
end

of course, all the sprites data will be saved as "momoosprites.lua to avoid any change from "sb-sprites.lua" so, i could manually update each new data :) for now, all i'm trying to figure is how to randomize each idles, i suppose i have to use that math.random in one of these code line?

we will see how it will go with some test! :D

oh and i will soon post a demo example for those who want to know how to get a dynamic time frame for one animation.

edit: i forgot to fix that tiny bug in the

local framedData = idleNormal2Frames[idleFrame]

 XD;;;;

(Edited 1 time)

alright! here how far i've done with the sprites and the like:

first of all, here the sprites sheet:

now here the animation of these sprites:

and now here 2 rooms wips i've done so far:

the second level which it's still far from done:

here a few icons i made for the "game":

the result of the "game":


bonus just for fun that i've done it before the release of PV8 0.70a, a pregnant version of the main character... ^^; :



that is all for now!

alright, after a few day of figuring out how to display correctly the hud and the room, i successed it, unfortunately, i encountered a weird bug that is driving me nuts... so, here the problem i have:

function Draw(HUD)
    if(drawHUD == true) then
        BackgroundColor(0)
        Clear()
        DrawTilemap(0, 0, 40, 8)
        drawHUD = false
    else
        BackgroundColor(31)
        Clear()
        DrawTilemap(16, hudHeight, 288, 112)
    end
end
function Draw(ROOM)
    BackgroundColor(31)
    Clear()
    DrawTilemap(16, hudHeight, 288, 112)
end
function Draw(OBJECTS)
    -- body
end
function Draw(SPRITES)
    BackgroundColor(31)
    Clear(16, hudHeight, 288, 112)
    DrawTilemap()
-- character position starter.
    local newX = 48
    local newY = 121
--that line of code will tell where to get the sprite data. so, the game will be able to animate them.
    local frameData = speakingNormal2Frames[idleFrame]
-- that little "if(frameData ~= nil) then" is REALLY important to add. so, it will not display "out of the range"
-- everytime i start the game.
-- each variable will be called from the array code at the start of file.
    if(frameData ~= nil) then
        DrawSprites(frameData.spriteData.spriteIDs, newX, newY, frameData.spriteData.width)
    end
-- We are going to detect if the mouse is on the screen. When the cursor is within the bounds
-- of the DisplayChip, we will show its x and y position.
    if (mousePos.x < 0 or mousePos.y < 0) then
    else
-- We also need to draw it to the display. We'll be using the DrawSprites() method to take the four cursor sprites and render them in a 2 x 2 grid.
        DrawSprites(greenCursorSprites, mousePos.x, mousePos.y, cursorWidth)
        OverscanBorder(1,1)
    end
end

any idea why it isn't  working like i wanted? also, the background bug is anoying as well. ah yes, here the pic of how annoying it is:

that is before i change Draw() to Draw(HUD), Draw(ROOM), Draw(OBJECTS), Draw(SPRITES) which the background color become all orange. 


any suggestions are welcomed!

I'm working on a better way to do screen split like this. I won't have a fix for a build or two. I really need to rethink how clear and background rendering work because the current implementation isn't going to be good for a game like yours when you need a mouse in a part of the screen where scrolling isn't happening.

so apparently it was a bug from your game engine? interesting... guess i will have to push further my planned release of the first prototype to september or october instead of august XD;

well, take your time to polish your game engine :)

I know, it's hard to build a game engine on a moving target. The goal is to be in beta by end of the summer so I can start focusing on cleaning up all the issues by the end of the year. I'll see what I can do to fix the background in the next release. The plan is to tackle smaller scope and get releases out every two to three weeks.