Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
How to make Bitmap.new from pack:getTextureRegion ? — Gideros Forum

How to make Bitmap.new from pack:getTextureRegion ?

RogerTRogerT Member
edited January 2013 in General questions
Hi guys,
I'm trying to make a sprite following an included example with the boat

function my_Sprite:init()

local pack = TexturePack.new("gfx/walk.txt", "gfx/walk.png", true)

self.anim = {

Bitmap.new(pack:getTextureRegion("s0000.png")),
Bitmap.new(pack:getTextureRegion("s0001.png")),
...

yet if I have like 100+ frames in the TextureRegion, it gets kinda dull to manually write every frame. Maybe there's a way to cycle all the frames in walk.txt ?

Thanks

Comments

  • SinisterSoftSinisterSoft Maintainer
    edited January 2013 Accepted Answer
    Here is an example...

    Bomb={}
    for loop=0,3,1 do
    Bomb[loop]=textures:getTextureRegion("bomb"..loop..".png")
    end

    Likes: RogerT

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.