Hi.
I'm having some issues with slowing down the speed of my scrolling back ground with a button press and then restoring the original speed once you depress. So far I've been using simple Transitions that loop once they go a curtain distance off the screen.
This has not been working for me, I just get choppy breaks and it does not restore to the correct position.
Any help would be appreciated!
1 2 3 4 5 6 7 8 9 10 11 12 | local function speedChange(event) if event.phase == "began" then mountain_big.x = mountain_big.x - xOffset*0.100 elseif ( event.phase == "ended" or event.phase == "canceled" ) then mountain_big.x = mountain_big.x - xOffset end end |
Rather than the way your doing it.
Create a speed variable
ie :
1 | local speed = 1 |
How exactly would I assign this variable? I'm using some of the code from the Horse animation template.
changing the "xOffset" changes the speed of that layer
Thanks!
1 | local xOffset = ( 0.2 * tDelta ) |
Something like (code below should work out of the box) :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | local offSets = { [1] = {x = 0.2 * tDelta *0.100}, [2] = {x = 0.2 * tDelta}, } local theOffset = offSets[1].x local function speedChange(event) if event.phase == "began" then theOffSet = offSets[1].x elseif ( event.phase == "ended" or event.phase == "canceled" ) then theOffSet = offSets[2].x end mountain_big:translate(-theOffSet, 0) return true end |
views:1442 update:2011/12/30 9:10:41
热门文章
GameCenter LeaderBoards and Achievements Enabled Through OpenFeint
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
相关文章
bullet movement
this is my code .. I'm not very handy .. I'm trying to learn! I can not seem to occur in the collision between the enemy and the
quick syntax question
testing line numbers
Memory Usage question (detecting leaks)
ads
Field of View / Shadow Casting Demo
Landscape working in simulator but not device
Space Lander Updated!! BIG UPDATE
SpriteLoq License Key
this is my code .. I'm not very handy .. I'm trying to learn! I can not seem to occur in the collision between the enemy and the
quick syntax question
testing line numbers
Memory Usage question (detecting leaks)
ads
Field of View / Shadow Casting Demo
Landscape working in simulator but not device
Space Lander Updated!! BIG UPDATE
SpriteLoq License Key
corona forums © 2003-2011