2D Map Scrolling
Blitz3D Forums/Blitz3D Programming/2D Map Scrolling
| ||
Hi all, I have been working on a small demo on how to make a player stay within the bounds of a map, yet scroll him at the same time the map is scrolling. I KNOW the map is horribly generated, but right now, I don't care... Here is what I have so far: What I need to do is keep the player in the middle of the map while scrolling. Thanks to all who help! :) |
| ||
If you wanted the player to remain stationary on your grid then this is what I got: |
| ||
The player is still not stationary o.o |
| ||
Do you want the player to remain stationary on the map? or do you want the player to "float" above the grid and remain the the center of the screen? |
| ||
Oh, it might be due to you having the Arrow keys both control the grid offset and the player's x location. Try This: Last edited 2012 |
| ||
i need it for the player to remain stationary on the map, until he reaches the end of the map. Something like Legend Of Zelda: A Link to the Past This effect: http://www.youtube.com/watch?v=FeJqjGE1AIk Watch 2 minutes of this, and u'll see what I mean. :) |
| ||
Once he reaches the end of the map, he can't go past the map as well :) |
| ||
Oh ok, I get it now. I will take a crack at it quick. |
| ||
Awesome! :) Thank you for helping me, and being patient with me! :) I appreciate it :) |
| ||
Any luck? :) |
| ||
Alright, I got it! Had to add a few things, hope that doesn't cause too many problems, but other than that, it is like u wanted it! |
| ||
it's PERFECT! :) Thank you, MK2V10! =D Also, is there a way u can get it to load save files, created by editor.bb? http://www.mediafire.com/?b0i5dp9i3f9qbkb Here's a link to the media, demo, and source :) If you can get the game to load the .dat level file, created with editor.bb, then problem solved :) Thanks again for being so patient with me, and for helping me :) It really means alot :) |
| ||
Ok, I think this will work... you just need to edit the name of the file to load and make sure the LoadAnimImage is pointed to the right image. Let me know how it goes, it worked on my end. Last edited 2012 Last edited 2012 |
| ||
This line, it says: " Expecting )' " : mapdat(X,Y)=ReadInt(FI) |
| ||
I fixed it, it is up in the previous post! |
| ||
Ok, now it's saying "Array index out of bounds" even though I used the level editor o.o Code: lvl1.map: http://www.mediafire.com/?8s6kcycu9757nla line it's doing this at: Thanks Mk2v10! :) |
| ||
I hope I'm not missing anything :) If I am, let me know! :) Thanks again! :) |
| ||
Try this, if that doesn't help the something is up with the file? Last edited 2012 |
| ||
CRAP! I gave u the wrong level editor code... My bad! >< Here's the one I need it to read: http://www.mediafire.com/download.php?wyvhe1cefejxnl8 Thanks, Mk2v10! :) |
| ||
K, I adapted it, hope there are no errors! |
| ||
GAH! Crap! >< It's still saying index out of bounds... Is there any way to make it stop doing that particular error? Thanks Mk2v10! :) |
| ||
Wow, that i'm not sure. The sizes are fixed, and the maximum size of the values are 1000 by 1000! Idk what is causing that. |
| ||
Here, perhaps ripping the file open will help u to see its true format :) Just draw a quick map, and press F1 to both save and SUPER save :) the file saves as: map1_decrypted.map :) Thanks again! :) Last edited 2012 |
| ||
The problem is in the Load() function |
| ||
Oh, the other function I made only to support Save, not super save. You might want to use save because it takes up less memory and is allows a more simple read. Try loading just a saved map and not a super saved. That might be the problem. |
| ||
No. I added that function so YOU could see what's going on with the map :) I'm not trying to load it with supersave(). I'm using regular save() & regular Load() :) |
| ||
Oh lol, srry, i did not go to bed yet lol |
| ||
Lol, np :P |
| ||
Ok, so... If the array is out of bounds, obviously, some value that ur using, is greater than the max allowed value o.o with the map size being 1601, I wonder, I wonder o.o |
| ||
Can anyone help us out on this array out of bounds problem, please? It would be a GREAT help! :) Thank You Mk2v10, & everyone for their help! :) |
| ||
Also, here's another small problem I noticed, I changed Dim Map$(1000,1000), to: "Dim Map(1000, 1000)", cuz it was trying to return a string, when it should be returning an integer :) This is what I have so far :) |
| ||
Here's what it returns for both for loops & debug mode: Last edited 2012 |
| ||
Did you find out the problem? And hey, you inspired me to start an API for grid control and drawing! I will post a link to it, but I will not post in on here (because I will be updating it as I go.) Check it out here: http://projectoutcast.forumup.com/viewtopic.php?p=24&mforum=projectoutcast#24 Oh, and don't mind the site being empty, I am just starting it, but feel free to join if you like. |
| ||
<3 U ROCK! I'm GLAD I could inspire u! =D In return for ur help, I will GLADLY join! :) Help me out some more, and lets see if I can't get u more members ^_~ And yes, I did.. But now it's buggy again >< Midimaster helped me on it some, to reduce the amount of lines, but now it's just messed up >< Here's the code: It hates me >< Last edited 2012 |