Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How do you scroll 2d top-down map with rotation

Author
Message
sskethan
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Oshawa, ON. Canada
Posted: 20th Nov 2011 16:25
I'm trying to get the character to scroll the map when he comes to the edge. I found a few tutorials, but they are all about scrolling in 4 direction. I would like the character to rotate. here is how far i have got so far. Can someone please help me figure this out. Thanks.

Attachments

Login to view attachments
Darkzombies
13
Years of Service
User Offline
Joined: 25th Dec 2010
Location: In multiple tabs, most likely youtube.
Posted: 20th Nov 2011 18:25 Edited at: 20th Nov 2011 18:26
Oh pretty much you just scroll the environment instead of the player. So scroll the projectiles (So they stay at the same speed) and the trees and stuff like that and the player stays still, and the environment moves at the same speed as you we're moving.



This only works for the X coord, and the left side (I think lol)
But you can easily add the right side (use playerX > 0) and the Y's

Its not too hard. The hard part is having to move all of your environment, if you have it all neat then you can just do a for next and select the array's and move all of their X and Y values (Of course types would be needed for this)

P.S. I didn't even read your code so don't get mad at me lol

-------------------------------------------------------------
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Nov 2011 21:36 Edited at: 20th Nov 2011 21:38
Something like this? I'm not entirely sure what you're talking about. You want the character to rotate but all pre-existing tutorials are about scrolling the map in 4 directions? So are you trying to make the character move or the map? 'Cause you mentioned two different subjects.



"You're not going crazy. You're going sane in a crazy world!" ~Tick
sskethan
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Oshawa, ON. Canada
Posted: 21st Nov 2011 16:21
Darkzombies
Thank you very much for the help.
Quote: "
P.S. I didn't even read your code so don't get mad at me lol
"

I would never. This is a wonderful site. Very helpful people.

Phaelax
That is a great example. Exactly what im trying to do. Thank you so much.
sskethan
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Oshawa, ON. Canada
Posted: 26th Nov 2011 20:45 Edited at: 27th Nov 2011 16:18
I have figured out how to get the sprite to move and scroll the screen now. Thank you everyone. But I'm stuck on the rotate when i run the program the sprite is facing 90 degrees but walks left when i press forward making him walk sideways.


I got it. All a needed to do is change line
rotate sprite 101, angle#
to
rotate sprite 101, (angle#)-90
and the sprite walks correctly
sskethan
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Oshawa, ON. Canada
Posted: 2nd Dec 2011 20:50
Could someone please help me to figure out how to add a data map like this



to this code supplied by Phaelax



I have tried several different ways but keep getting a blank white screen
EricB
13
Years of Service
User Offline
Joined: 3rd Nov 2011
Location:
Posted: 9th Dec 2011 16:51
This is the relevant part of the code. I helped the original author with this part as well.
old code
ink map(x+1,y+1).color, 0 `<<<<< note ink command
ix = (x - sx)*MapTileSize - ox
iy = (y - sy)*MapTileSize - oy

new code
paste image map(x+1,y+1),ix,iy `<<changed to paste image
ix = (x - sx)*MapTileSize - ox
iy = (y - sy)*MapTileSize - oy
sskethan
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Oshawa, ON. Canada
Posted: 9th Dec 2011 18:07
thank you for getting back ... I noticed that. I should have replied here. Rotation and scrolling are working great now.

Login to post a reply

Server time is: 2024-11-22 10:59:44
Your offset time is: 2024-11-22 10:59:44