It looks like you're new here. If you want to get involved, click one of these buttons!
-------------------------------------------- -- TNT Animator Studio 1.00 -- -- Copygiht (C) 2012 By Gianluca D'Angelo -- -- All Right Reserved. -- -------------------------------------------- -- example 1 ** walking guys ** -- -------------------------------------------- -- for GIDEROS 2012.2.2.2 or above -- -------------------------------------------- application:setKeepAwake(true) application:setBackgroundColor(0x252530) -- just read texture pack local texturePack = TexturePack.new("boyPack_1.txt", "boyPack_1.png") local background = Bitmap.new(Texture.new("logo.png")) -- init texture animation loader and read animations... animLoader = CTNTAnimatorLoader.new() -- REAL CODE FOR MANAGE ANIMATION -- read nimation infos from file "boyPack_1.tan" use texture pack defined in texturePack and center all sprites... animLoader:loadAnimations("boyPack_1.tan", texturePack, true) -- REAL CODE FOR MANAGE ANIMATION cBoy = Core.class(Sprite) function cBoy:init() self.anim = CTNTAnimator.new(animLoader) -- REAL CODE FOR MANAGE ANIMATION self.direction = math.random(1, 4) if self.direction == 1 then self.anim:setAnimation("BOY_LEFT") elseif self.direction == 2 then self.anim:setAnimation("BOY_RIGHT") elseif self.direction == 3 then self.anim:setAnimation("BOY_UP") elseif self.direction == 4 then self.anim:setAnimation("BOY_DOWN") end self.anim:setSpeed(math.random(60, 120)) self.anim:addChildAnimation(self) -- REAL CODE FOR MANAGE ANIMATION self.anim:startAnimation() -- REAL CODE FOR MANAGE ANIMATION self.xPos = math.random(0, 320) self.yPos = math.random(0, 480) self.speed = self.anim:getSpeed() * 500 self.w = application:getLogicalWidth() + 32 self.h = application:getLogicalHeight() + 32 self:setPosition(self.xPos, self.yPos) self:addEventListener(Event.ENTER_FRAME, self.onEnterFrame, self) end function cBoy:onEnterFrame(event) if self.direction == 1 then self.xPos = self.xPos - (self.speed * event.deltaTime) if self.xPos < -32 then self.xPos = self.w end elseif self.direction == 2 then self.xPos = self.xPos + (self.speed * event.deltaTime) if self.xPos > self.w then self.xPos = -32 end elseif self.direction == 3 then self.yPos = self.yPos - (self.speed * event.deltaTime) if self.yPos < -32 then self.yPos = self.h end elseif self.direction == 4 then self.yPos = self.yPos + (self.speed * event.deltaTime) if self.yPos > self.h then self.yPos = -32 end end self:setPosition(self.xPos, self.yPos) end stage:addChild(background) local boy = {} for j = 1, 25 do boy[j] = cBoy.new() stage:addChild(boy[j]) end |
Likes: fxone, atilim, QuasarCreator, Yan
Comments
My apps: http://www.yummyyellow.com
@atilim: I think this was discussed here but did you get any further on extending the API to cover this functionality?
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
for tnt animator you can use texture pack with mixed game gfx with no problems. ex. in boyPack_1.png you can have all animation sprites plus other game graphics... tnt animator studio use and allocate only used animation sprites. gfx.
www.tntengine.com
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
iTunes: http://itunes.com/apps/glennbacon
Amazon: http://www.amazon.com/s/ref=bl_sr_mobile-apps?_encoding=UTF8&node=2350149011&field-brandtextbin=Glenn Bacon
stay tuned !
check your mail box!
www.tntengine.com
@fierceblaze
hey guys can you send your emails please?
(gregbug @ gmail dot com)
thanks.
www.tntengine.com
BETA 1 IS ALIVE !!!
Simple docs coming very soon...
www.tntengine.com
https://github.com/jakesgordon/javascript-boulderdash/blob/master/images/sprites.png
Dislikes: troysandal
My apps: http://www.yummyyellow.com
but i think you can extract frames from your png (ex. with gimp) and then "repack" with gideros...
www.tntengine.com
www.tntengine.com
i'm writing some docs...
for now only 1 example and no docs at all...
the animator lib is very "basic" for now... (just essential functions for animation... next adds will be events and (but i'm not sure) collision (circle and rectangle) system (i'd like to write using C NDK))
... writing little docs now ...
www.tntengine.com
My apps: http://www.yummyyellow.com
added VERY VERY SIMPLE REFERENCE DOC.
(see example 1 on how to use)
------------------------------------------------------------
CTNTAnimatorLoader Class
CTNTAnimatorLoader:init()
CTNTAnimatorLoader:loadAnimations(fileName, texture, midHandle) -- load animations
CTNTAnimatorLoader:free() -- free animator loader memory
------------------------------------------------------------
CTNTAnimator Class
CTNTAnimator:init(AnimatorLoader) -- init animation
CTNTAnimator:free() -- free animation memory
CTNTAnimator:getLoop() -- get if animation is looped or not --
CTNTAnimator:setLoop(setLoop) -- set animation Loop On/Off --
CTNTAnimator:getSpeed() -- get animation speed (in millisecs) --
CTNTAnimator:setSpeed(ms) -- set animation speed (in millisecs) --
CTNTAnimator:getFrameCount() -- release frame count of current animation
CTNTAnimator:setAnimation(AnimationName) -- set current animation (defined with editor)
CTNTAnimator:getAnimation() -- get current animation name
CTNTAnimator:isVisible -- not yet implemented
CTNTAnimator:setVisible -- not yet implemented
CTNTAnimator:addChildAnimation(parentGroup) -- add animation to scene group
CTNTAnimator:startAnimation -- start animation (from 1st^ frame)
CTNTAnimator:stopAnimation -- stop animation (on predefined stop frame)
www.tntengine.com
Going to see how easy I can whip up a simple example using this so far it looks great Greg
new in this update:
=======================================================
Added EVENTS.
Added Example 2 to show how use events and runtime animation speed variation.
– BUGFIX (Windows) Editor
if Animation not looped and with no default StopOnFrame defined player crash - reported by Teranth
– Added CTNTAnimator:animationRunning() return True if animation is running else false
– CHANGED CTNTAnimator:startAnimation to
CTNTAnimator:playAnimation(playFromFrame)
playFromFrame is optional and if defined animation start from here
also if you call startAnimation when animation is running no code is executed.
StartAnimarion raise event ANIM_START when animation is started
– CTNTAnimator:stopAnimation(stopOnFrame)
stopOnFrame is optional and if defined animation stop here.
also if you call stopAnimation when animation is stopped no code is executed.
stopAnimarion raise event ANIM_STOP when animation is stopped or ended.
– setAnimation(AnimationName)
if “AnimationName” is current animation no code is executed.
========================================================
hope you like!
ps: for user that contact me by tnt email support (jose... Gibb...) to join beta test program:
i need your email... if you want to join beta test program send me you email !
Happy coding!!
Ps to all beta tester:
if you make some little nice examples and want to add in animator official package as an example... just email me... and i'll add in next update
B-)
EDIT: example 2 work only on device !!! (it uses accelerometer)
www.tntengine.com
example:
"BaseWalkWest" -> "BASEWALKWEST"
i forgot to write in "docs".
sorry. :P
www.tntengine.com
CTNTAnimatorLoader:loadAnimations(fileName, texture, midHandle)
if midHandle is true all animation frames are mid handled (same as setting setAnchePoint(.5, .5)) else animation frames are 0,0 handled.
BTW just added (and so avaible from next beta)
CTNTAnimator:setAnimAnchorPoint(x, y)
that set bitmap handle for all animation frames to x, y) ...
work exactly as (gideros) setAnchorPoint(x, y) so...
----
Sets the anchor point of Bitmap object.
Each Bitmap object has an anchor point that affects the positioning of the texture displayed. By modifying the anchor point, you change the origin of the texture. For example, setting the anchor point to (0.5, 0.5) moves the center of the texture to the origin. If you set the anchor point to (1, 1) instead, the bottom-right corner of the texture will be the origin. The default value of anchor point is (0, 0) which means top-left of the texture is the origin by default.
Parameters:
x: (number) The x coordinate of anchor point. Usually between [0, 1].
y: (number) The y coordinate of anchor point. Usually between [0, 1].
----
hope it helps.
www.tntengine.com
TNT Animator is coming nicely...
not so many bugs (at least reported from beta tester!) :P
new features for beta3 (out for beta tester tomorrow):
added (after @ruxpin report)
+ CTNTAnimator:setAnimAnchorPoint(x, y, [animation])
set all animation frames to x, y handle.
"animation" is optional: if defined AnchorPoint is applied only on this animation.
ex. anim:setAnimAnchorPoint(1,1, "BOY_LEFT") anchor point is applied only on "BOY_LEFT" animation.
+ improved event system. now events return the name of the current animation. ( see events on example 2 )
now back to code...
ciao!
www.tntengine.com
is there a volunteer who wants to correct / integrate the documentation?
as you know, i'm really bad writing English. ">
www.tntengine.com
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill