Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-30-2011, 03:02 PM   #1 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 10
allenjones2003 is on a distinguished road
Question how do you create looping transition in Corona?

Hi,

im new to iphone developing and just starting out using corona, but have come stuck on something and would love someone's help!!

i want to create a looping action where an object of mine stays within the screen boundaries but the x axis constantly moves back and forward so it would basically move from left to right over and over.. any help would be greatly appreciated!!

thanks!
allenjones2003 is offline   Reply With Quote
Old 03-31-2011, 03:02 AM   #2 (permalink)
Registered Member
 
Jay Jennings's Avatar
 
Join Date: Jan 2009
Posts: 28
Jay Jennings is on a distinguished road
Default

A few weeks ago I put together a video tutorial showing how you can do that in Corona:

Learning Corona w/Ghosts vs Monsters | Game Dev Nation

Okay, technically my example changes the Y coord and something goes up and down, but you could easily modify it to change the X coordinate for side to side movement.

Give it a shot and see if it helps you.

Jay
__________________
Game Dev Nation - Tips and tutorial for Corona SDK developers. http://GameDevNation.com
Jay Jennings is offline   Reply With Quote
Old 03-31-2011, 07:25 AM   #3 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 10
allenjones2003 is on a distinguished road
Default thanks!

hi Jay,

thanks alot for getting back to me, i'm at work at the moment so can't try this right now but as soon as I get home i'll give it ago and let you know. Sounds like it will be a great help.

thanks again!
allenjones2003 is offline   Reply With Quote
Old 03-31-2011, 03:03 PM   #4 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 10
allenjones2003 is on a distinguished road
Default

Quote:
Originally Posted by Jay Jennings View Post
A few weeks ago I put together a video tutorial showing how you can do that in Corona:

Learning Corona w/Ghosts vs Monsters | Game Dev Nation

Okay, technically my example changes the Y coord and something goes up and down, but you could easily modify it to change the X coordinate for side to side movement.

Give it a shot and see if it helps you.

Jay

Hi Jay,

just been looking at your tutorial, has been a great help and you described everything great. But once I write the code for my animation the screen goes black so I know something is wrong but i can't find it! can you please help me?
my code so far is:

--> hide the status bar
display.setStatusBar(display.HiddenStatusBar)

--> add wooden block
local woodenblock = display.newImage("wooden_block.png")
woodenblock.x = 240
woodenblock.y = 188

--> block looping

local function woodenblockAnimation()
local animUp = function()
transition.to(wooden_block, { time=400, y=193, onComplete=woodenblockAnimation })
end

transition.to(wooden_block, { time=400, y=183, onComplete=animUp })
end

woodenblockAnimation()


all i want is my image to move from left to right at the top of the screen staying in the screen boundaries and looping constantly.. i know my y axis code is wrong for that but i just used this to get the animation working but i just get a black screen..
any advice would be much appreciated!

thanks
allenjones2003 is offline   Reply With Quote
Old 03-31-2011, 03:19 PM   #5 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 10
allenjones2003 is on a distinguished road
Default

Quote:
Originally Posted by allenjones2003 View Post
Hi Jay,

just been looking at your tutorial, has been a great help and you described everything great. But once I write the code for my animation the screen goes black so I know something is wrong but i can't find it! can you please help me?
my code so far is:

--> hide the status bar
display.setStatusBar(display.HiddenStatusBar)

--> add wooden block
local woodenblock = display.newImage("wooden_block.png")
woodenblock.x = 240
woodenblock.y = 188

--> block looping

local function woodenblockAnimation()
local animUp = function()
transition.to(wooden_block, { time=400, y=193, onComplete=woodenblockAnimation })
end

transition.to(wooden_block, { time=400, y=183, onComplete=animUp })
end

woodenblockAnimation()


all i want is my image to move from left to right at the top of the screen staying in the screen boundaries and looping constantly.. i know my y axis code is wrong for that but i just used this to get the animation working but i just get a black screen..
any advice would be much appreciated!

thanks


sorry mate ignore that!! just seen what i did.. i used the image name rather than the function name for the animation and it now works! thanks alot for your help!!
allenjones2003 is offline   Reply With Quote
Old 03-31-2011, 04:24 PM   #6 (permalink)
Registered Member
 
Jay Jennings's Avatar
 
Join Date: Jan 2009
Posts: 28
Jay Jennings is on a distinguished road
Default

No problem. If I had a nickel for every time I asked for help -- and then found the problem minutes later -- I'd have a LOT of nickels!

Jay Jennings
__________________
Game Dev Nation - Tips and tutorial for Corona SDK developers. http://GameDevNation.com
Jay Jennings is offline   Reply With Quote
Reply

Bookmarks

Tags
corona, loop, transition

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 368
12 members and 356 guests
condor304, dansparrow, dre, ilmman, LezB44, michelle, Objective Zero, samdanielblr, Sami Gh, shagor012, thephotographer, tinamm64
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,119
Posts: 402,896
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:37 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0