Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Vertical Rotate ( urgent ) (Mert's in Global Game Jam; let's help him - Admin) — Gideros Forum

Vertical Rotate ( urgent ) (Mert's in Global Game Jam; let's help him - Admin)

mertocanmertocan Member
edited January 2013 in General questions
Is it possible to make vertical Rotate with movieClips? I am in GGJ now i need quick answer pleasee :)

Likes: gorkem

+1 -1 (+1 / -0 )Share on Facebook

Comments

  • gorkemgorkem Maintainer
    Hey - let's help Mert achieve his goals in GGJ as much as we can :)
  • keszeghkeszegh Member
    edited January 2013
    i think only with meshes can one emulate 3d rotations.
  • It is not 3d rotation. For example i have a man on stage whose face looks to x+ , but i want him to look x-. Sorry for bad english:D hope you understand me :)
  • @mertocan Do you mean xflip not rotate?
    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
  • GregBUGGregBUG Guru
    edited January 2013 Accepted Answer
    @mertocan
    if I understand your question
    try this way:

    Sprite:setScaleX(-1)

    sprite is flipped on x.

    open "Texture Pack" Gideros example
    on file animatedsprite.lua
    in function AnimatedSprite:init()
    add

    self:setScaleX(-1)
    self:setPosition(100,100)


    it works on movieclips also.

    hope it helps.

    Likes: SinisterSoft, omer

    TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
    www.tntengine.com
    +1 -1 (+2 / -0 )Share on Facebook
  • Take a look at @144mb's tiled v2. example that uses TNT pad also. It has the same thing as you wanted. Btw which one are you attending @mertocan ?
  • bowerandybowerandy Guru
    edited January 2013
    @mertocan,

    Here's an example of a little game I built in Gideros to help with my daughter's reading. It uses tweening of setScaleX() amongst other things to give a vertical axis flip of an animation. In the game the main character walks left and right based on device tilt. Is this the sort of thing you're looking for?


    Here's the pertinent code:
    function PrincessMilly:onEnterFrame()
    	local game=PrincessMillyGame.current
     
    	if self.walking~=0 then
    		self:walk(self.walking)
    	else
    		local ax, ay, az=game.accelerometer:getAcceleration()
    		if ay>PrincessMilly.WALK_HYSTERESIS then 
    			self:walk(-PrincessMilly.WALK_SPEED)
    		end	
    		if ay<-PrincessMilly.WALK_HYSTERESIS then 
    			self:walk(PrincessMilly.WALK_SPEED)
    		end	
    	end
     
    	game.camera:lookAt(self)
    end
     
    local function sign(x)
      return (x<0 and -1) or 1
    end
     
    function PrincessMilly:walk(speed)
    	local x=self:getX()+speed
    	self:setX(x)
     
    	local angle=math.sin(x/PrincessMilly.JOSTLE_SPEED)*PrincessMilly.JOSTLE_AMOUNT
    	self:setRotation(angle)
     
    	if sign(speed)~=sign(self.lastWalk) then
    		GTween.new(self, 0.5, {scaleX=sign(speed)})
    	end
    	self.lastWalk=speed
    end
     
    function PrincessMilly:walkLeft()
    	self.walking=-PrincessMilly.WALK_SPEED
    end
     
    function PrincessMilly:walkRight()
    	self.walking=PrincessMilly.WALK_SPEED
    end
    Hope that helps.

    best regards

    Likes: SinisterSoft, omer

    +1 -1 (+2 / -0 )Share on Facebook
  • @bowerandy nice little game, I bet your daughter loved it. :)
    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
  • @mertocan Since GGJ is finished maybe you can share your game with us here or a link to it :)
Sign In or Register to comment.