Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Scrollable area for printing data inside — Gideros Forum

Scrollable area for printing data inside

somezombiegmsomezombiegm Member
edited July 2015 in General questions
Hello guys. I want to show friends scores in a similar way Subway Surfer does, with an area only for the user's name, score and pic, if you have too much friends, you can scroll up or down to check them out.

image

I have all my data in a table already.
What I want to know is how to create that scrollable area so I can loop my table inside it and print the data (images and text).

Comments

  • SinisterSoftSinisterSoft Maintainer
    make a sprite, set a clip area, add your children, change their position within that sprite.
    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
  • I started searching about clipping, but then I remembered I already implemented AceSlide for something different, so I used that.

    @SinisterSoft thanks anyway

    Here's something similar to what i did:
    -- Create slider
    slider = AceSlide.new()
    self:addChild(slider)
    self.box = {}
     
    --------------- Initialize Slider ---------------
    -- Load all the data of the users, add it to a box sprite and then add the boxes to the slider
    -- Loop through users
    for i, value in pairs(data) do
     
    	-- Create box sprite
    	self.box[i] = Sprite.new()
     
    	-- Add everything you want to each box sprite
    	self.box[i]:addChild(data.text)
    	self.box[i]:addChild(data.image)
     
    	-- Add box to slider
    	if i == 1 then -- this will be the one selected
    		slider:add(self.box[i], true)
    	else
    		slider:add(self.box[i])
    	end
    end
    -- Show Ace slide
    slider:show(150)
    :) :)
    lua
    lua
    AceSlide.lua
    7K
Sign In or Register to comment.