Pages: 1
Topic closed
I'm making a scrolling game that has a first-person perspective (the background moves left or right depending on where you look).
In this game, there are other characters who walk from left to right across the screen.
I know how to make them walk across the screen, and I know how to make them scroll along with the background as you look around (if they are standing still, of course). What I DON'T know how to do is to make it so that they walk from point A to point B at the same "speed" even while you look around.
For example, let the other character's walking speed be 5. If you aren't looking around, their walking speed will be 5, and their x position on the screen will also be changing by 5.
If you are following them with your eyes, their walking speed will still be five, but their x position on-screen will not change since you are following them.
If you are scanning to the left (behind the other character), their walking speed will still remain at 5, but their x position on-screen will be changing by more than 5.
If you are scanning to the right (in front of the other character), their walking speed will, again, remain at 5, but their position on-screen will be shifting to the left since you are scanning ahead of them.
It's a problem of perspective, and it has me stumped. Please help.
Offline
I don't know if you will find it helpful (since it's not from first person perspective) but if you look at the meteors and the coins in this scroller, they are moving realisticly with respect to the landscape.
http://scratch.mit.edu/projects/Paddle2See/171502
Offline
One of the ways I use is I use archmages method of scrolling, u see the (( 480 <*> 0 ))
part, I put a variable called Xpos (though u can call it whatever u want),
(( 480 <*> <{ Xpos }> ))
Then on the character ur looking at I put
<when green flag clicked>
<set{ Xpos }to( 0
<forever>
<change{ Xpos }by( (( 5 </> 480 ))
<end>
Offline
Topic closed
Pages: 1