USERNAME:
PASSWORD:
Save Info!
Logging in…
This topic is 1 page long.
[ Profile | Posts | Contact ]
Posted at: 1/10/09 10:21 PM
Sign-Up: 10/18/07
Posts: 43
I've got the makings of quite a nice platformer, but I can't seem to make it sidescroll. I've got all the player movements in place and everything, I just want to know how to make the screen scroll when the player gets within a certain distance of the side of the screen.
Posted at: 1/10/09 10:26 PM
Sign-Up: 03/29/07
Posts: 989
Kind of like this:
if((character._x < 100 && dir == -1) || (character._x > Stage.width - 100 && dir == 1)) { level._x -= speed * dir; } else { character._x += speed * dir; }
If the character is by the left side and going left, or by the right side and going right, then move the level. Otherwise, move the character. In the first part, you'll have to put other things you want to move (i.e. enemies or whatnot).
I am a servant of the Most High God The Hanging Collab || The Legend of Newgrounds (Game) || Crystal Rays (Song)
Posted at: 1/10/09 10:31 PM
Sign-Up: 03/02/06
Posts: 1,260
onEnterFrame=function(){ if(_root.guy._x>500){ _root._x++; } }
if the guy's further along than 500, move the stage to the right. You wouldn't think _root._x was an actual thing but it is.
Posted at: 1/10/09 10:52 PM
Hmm, neither of those work.
Posted at: 1/11/09 01:14 PM
Sign-Up: 10/05/08
Posts: 32
Use this http://www.oreillynet.com/pub/a/javascri pt/2004/08/17/flashhacks.html?page=2 It's a cool AS2 camera that shows everything through a rectangle or other shape.
Posted at: 1/11/09 01:47 PM
Sign-Up: 01/13/07
Posts: 1,833
use a while loop it works better and can handle any speed
while(_x>400){ _root.ground._x-- _root.player._x-- } while(_x<100){ _root.ground._x++ _root.player._x++ }
that is extremely simplified but uses no variables so i like that better.
Grah i feel so unknown, SK8MORE god damn :/ EvanHayes seems like a much more serious name than sk8more,so i changed it.
Posted at: 1/13/09 09:49 AM
At 1/10/09 10:52 PM, TazarTheYoot wrote: Hmm, neither of those work.
It works perfectly for me, so you just don't know how to implement it.
All times are Eastern Standard Time (GMT -5) | Current Time: 07:14 PM
<< Back