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 / Scrolling Methods

Author
Message
Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 19th Mar 2011 16:41
I am having a little dificulty in coming up with a way which i would make a map, say for example a 2d isometric game. I am not sure how i would make the background, how i would make it scroll with the character and how i would add objects like trees and houses, how the collision would work on those objects (being that they wont be fixed to a position)
I made a very simple background out of a grass texture and made a character thatcould move around on it, but i wouldnt know how to expand that to be bigger than the screen.
I dont really want to use a tileset as i know nothing about them and i cant draw anyway but even if i did i cant find anything useful on how to make maps and scroll through them (not just left to right but up and down).

Where do i begin with this as i am now 95% through my hands on volume 1 book and i have the knowledge of hundreds of commands at my fingertips but cant use any of it to do what i want.

I am trying to learn by making a simple 2d rg before moving onto the 3d stuff and beyond so now i have read through my book and dozens of tutorials on here and watched countless videos, i have a character that i got from some guys site, i have the most horrifying bad background of a stretched grass texture and i can move the guy up down left and right.
Now some tutorials i have looked at are difficult to take seriously as the commands are now outdated or the code does not compile, this wont help a noob like me as i wont work out what to do to make broken code work, im simply not at that stage just yet.

Whats the next step?
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 20th Mar 2011 09:50
Most isometric games use an array to store the tiles. It draws them from top to bottom and places the character in the center of the screen when it gets to the middle tile and continues to draw the rest of the tiles. If there's a tile like a tree that's right in front of the player because the tree is drawn after the player is placed he'll appear behind it.

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 20th Mar 2011 10:17
i dont think i would know how to go about doing that. Like i say, i am at the annoying stage at the moment where i know what tons of commands are and can knock up a very mini demo to demonstrate the single use of them but cant think of methods to make anything i want.

I dont really want to mess around with tiles as i think it could be done easier (but what do i know) if i tried to do it like an RTS. Sort of just off top and side view so still that isometric type view. But possibly a camera movement based round the sprite, and possibly for the map some sort of map making tool like you would get for a 3d game but i dont know what and dont know where to start. And still would know how to make objects sit on the landscape that the player can either interact with or cant bump into etc. I really dont know what to do next. I am just sat here with the knowledge on how to make an array and fill it and display the contents, or how to make a UDT, or some of the sprite commands or some of the other hundred or so DB pro commands and yet i cant move forward.
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 20th Mar 2011 18:37
If you don't mind posting your progress so far it'll help us pinpoint your situation.

Isometric are tricky it takes a while to get the hang of it. Just because it's 2d don't necessarily mean it's any easier than 3d there's a lot of small tricks you need to know to make it run smoothly.

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 20th Mar 2011 19:04
I really havent done anything as far as setting up a map is concerned. I do not even know where to start. I guess i could load a bmp but i would have to make a huge one for a map, but i dont know how to keep it moving along with the character. Could i make a 3d map from some world builder, import that as an object already textured and lit then move my sprite around it, and if so how would i make the world move round him while keeping the camera position focused on the character. As i said before, i dont really think i should get into tiling as for 1 i cant draw, 2 there are very little tile sheets i could use and 3 it probably wouldnt look as good as a drawn image or perhaps 3d model. What i meant by isometric was perhaps just the viewpoint. Not quite top down, not quite to the side, a mixture of both, an isomentric viewpoint. I have that sprite (attached to one of my other requests for help) that is done in an isometric way (8 directions for moving) so i was trying to use that.

But even if i stray away from that viewpoint for now. How would i get started in making the screen scroll with a character the way i would want it. I read through 700 pages of hands on vol 1 and about the first 150 pages of the second volume (the free pdf that gives you part of it). While it is an excellent book it does claim that you are ready for making 2d games after this.

I dont feel i am as i could only make very poor demos to demonstrate what i have learned about single commands here and there, perhaps combining one or two. Making a game is a combination of problem solving that those books (or any tutorial i have come across so far) does not teach you. Its a mentality i just dont have right now, so i need hand holding till i can stand on my own two feet, i just havent a clue what peeps did before the net because you dont just wake up with this knowledge on how to make a scrolling map, someone must have taught them technics that can them be experimented on and expanded, unfortunatley very little i have learned so far can be expanded upon.

Forgive my frustrated tone but i have worked solid (the five hours a day between finishing work and sleep) for the last 6 weeks coding from complete beginner level (i know what a computer is and how to turn it on and i am a slight amount computer minded but a total beginner to programming - though i did know about variables before this - that was the extent of my programming, zero) and have now hit a bit of a wall with everything that i want to do.

I have so many ideas and problems i can think of very loose solutions to but cant code them into something useable. Please check out my god auful demo in my "Stopping the Play Sprite Animation" thread. Perhaps this will give you an idea of the scroll i may be looking for.

All help is greatly appreciated. I feel i am on the brink of cracking this
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 20th Mar 2011 19:20
Well, if you think about total 2d, not isometric, then you can scroll (without any lag) 2500 tiles, i bet 3000 would do too, because i tested it, at 5000 it's... very laggy. If you think about isometric, then i think you can do the same as in 2d . If you want to have bigger map, then onptionally i would keep max to 3.000 tiles, but increase their size (like from 32x32 ( in 2d ) to 64x64).

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Mar 2011 21:32
If the size of your tile grid affects your frame rate in any way then you are doing it wrong.

If the tiles are held in a 2D array, and the tiles are of fixed size, then it is possible to convert your world coordinates to array coordinates to determine a rectangle of tiles to display. You then simply iterate through that rectangle and paste the images to the correct location on screen.

Converting that simple horizontal view to an isometric view (although I've never done it myself) should be fairly simple. It should be something like pasting horizontally across the display while reading diagonally from the array. Then the next row should be offset half a tile display-wise, while moving back a whole tile in the array, then pasting horizontally across the display while reading diagonally from the array - repeat until the display is complete.

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 20th Mar 2011 22:41
@ Somarl:

You probably know how to do it already you just don't realize it. If you know how to work with an array and you know how to load images and how to display those images you're already there. You just have to put them together. A simple 2D array will work to store the images numbers of the tiles or if you want it a bit more advanced you can add layers (a 3Dish array). A bottom layer for the floor tiles, the second layer for walls, the third layer for bad guys, the forth layer for treasure/items, the fifth layer for building roofs. Games like Ultima Online have over 16 different layers so they can stack items on top of each other and have multiple story buildings.

A lot of us older programmers started before the internet existed (like IanM and myself). We learned mostly from books and the school-of-hard-knocks-and-buggy-code.

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Mar 2011 23:02
Quote: "A lot of us older programmers started before the internet existed"

Uh, I was going to take exception to that, but as ARPANet was created just a few months after I was born, I can't really because it's actually true

Quote: "We learned mostly from books and the school-of-hard-knocks-and-buggy-code"

Yep, that's true too, especially the last two words of it!

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 21st Mar 2011 01:36
i kind of wanted to stay away from tiles i as cant really draw any. I was thinking of maybe a 3d map in a world editor or something rotated at a sort of top down view (but not fully top down, like the isometric viewpoint).
Is this possible? If so how? Would it be a case of make the world, split into different areas the display the 8 around the players current location, so you could save a little space rather than have the whole world loaded. See image (i apologise for ripping dragon ages map but it was the best one to do an example on that popped up when i searched images).
When the character gets to a certain point on the "world" co-ordinate (not that i would know how to define a world co-ordinate that is not part of the current display, but when he gets to a point on the map it deletes the ones behind him and loads up the ones in the direction he is going?

Also back to tiles (which again i really dont want to use) but if i did, the thing is, i know arrays (to a degree), i can load and paste images but all this talk about storing the images in the array and loading it out on the screen, i wouldnt know where to start. I cant get my head round the theory. How would you know what tile to display. How can you do that through an iteration. Set up some sort of user defined array? Sorting the image number then x and y co ordinates for where the top left of each image is to be placed? If so then where to go from there. How do they move with the character, when do they get drawn.

Honestly i just dont get how arrays would work with tiles, i dont get tiles full stop. I wanted to do them at first because i was hoping it would teach me something but i think i would rather know a little more theory about how tiles work (and i have read everything there is to know about tiles, i understand none of it, its gibberish to me, i also think i have a major blind spot with arrays because i can go through the book and do all the examples because i can demonstrate use of arrays only to the example, i just dont get them in a practical sense as i have not needed to use them yet, and now that i do i cant think of how to use them)

I would rather go about the problem perhaps a different way like the one mentioned above with a 3d world but i would still love to know fully just how tiles work as an exercise, and a 3d map i think would post a whole set of problems i am not ready to deal with yet (how the character would walk over bumps rather than glide through hills is something i cant think of yet).

All help and comments appreciated, i will learn something someday

Attachments

Login to view attachments
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 21st Mar 2011 03:30 Edited at: 21st Mar 2011 03:38
Quote: " Would it be a case of make the world, split into different areas the display the 8 around the players current location, so you could save a little space rather than have the whole world loaded. When the character gets to a certain point on the "world" co-ordinate (not that i would know how to define a world co-ordinate that is not part of the current display, but when he gets to a point on the map it deletes the ones behind him and loads up the ones in the direction he is going?"


You are on the right track, but instead of deleting and loading images, you would use an array to store the type of terrain in each place the character can move. The character's position in the world directly relates to the dimensions of the array.

Here is a very basic example of storing a map in an array, and using tiles to display the map. This example displays the whole map and the player moves around. I will also post an example of how to keep the player centered and just display the 8 tiles around the player location.





Attachments

Login to view attachments
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 21st Mar 2011 04:42 Edited at: 21st Mar 2011 05:39
Part Two. This version displays the terrain around the player. I used a 5 by 5 square because it's easier to see the movement.



You will need to download this image and save it in the same project folder as wherever you put the code. Save it as "Tiles.png"



It was taken from David Gervais tileset graphics. You can find them here. Scroll down the thread.

This should give you a good grasp of "scrolling" the terrain. To do the same thing with an isometric view is a bit more complex. As noted above, you'll need to offset the tiles. Some good iso tilesets can be found here.

Here is a World Builder program

Attachments

Login to view attachments
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 21st Mar 2011 05:38
Quote: "Uh, I was going to take exception to that, but as ARPANet was created just a few months after I was born, I can't really because it's actually true "


I didn't know the internet was that old. Well I was born in 1971 when the first emails were sent.

Quote: "Yep, that's true too, especially the last two words of it! "


Yeah... I still love bug hunting to this day.

Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 21st Mar 2011 09:07
Quote: "A lot of us older programmers"


Hrmph. I started programming in 1972, on punch cards no less (no budget for anything better). Does that make me a REALLY older programmer?

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 21st Mar 2011 10:11
Thats great Rich, just what i needed, lots of diagram and explanations
Im going to have a proper look at it when i get back home from work but from the quick look that i saw, i have seen similar things to the data structure. I take it all the ones and twos are refferring to pictures that make up tiles. For more pictures you would just have

data 1,1,1,3,5,5,5,5,1,1
data 1,1,2,3,1,2,2,2,1,1
data 1,1,2,15,15,15,2,2,1,1
data 1,1,2,15,15,15,2,2,1,1
data 1,1,2,7,7,7,2,2,1,1

Or something. If this is the case, planning a map out must be a pain in the behind as its a bit difficult to visualise (if you used a lot of tiles) what your map will look like (unless the world builder tells you how to lay out your data) but i can see how it might work. Cant wait to get back home tonight to check out your examples.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 21st Mar 2011 10:55
Quote: "Hrmph. I started programming in 1972, on punch cards no less (no budget for anything better). Does that make me a REALLY older programmer?"


I consider somebody that's programmed for 20+ years as an older programmer. You get extra coolness points for starting on punch cards... I've heard how difficult they were to work with.

Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 21st Mar 2011 14:57
Quote: "I take it all the ones and twos are refferring to pictures that make up tiles"


Right! But you'll probably want to store more than just the picture used for each location. That's where a UDT comes in handy.

Consider this...



etc., etc.

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Mar 2011 15:25 Edited at: 21st Mar 2011 15:57
@Somarl,
2D Isometric IS tiling, only there's a horizontal offset for each row (of half a tile), and (usually) a half-tile overlap vertically.

Because of that overlap, you need to paste with transparency enabled.

There are many examples of tilesets for isometric games available on the net - for example: http://opengameart.org/content/isometric-64x64-outside-tileset

[edit]
Also (and I should have thought of it earlier), carry out a quick title search of 'isometric' in the 2D forum - quite a few bits and pieces there.

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 21st Mar 2011 16:34
There is some good stuff there.
@ Ian i was talking about the viewpoint, that sort of offset 45degree ish angle when i was talking about isometric, thats the viewpoint i was thinking of having, wether or not to use tiles yet im not sure, but there are some great resources there. I couldnt find anything. Then again i only want to be able to do it, rather than rely on it to actually make something big so its all good.

How would i put objects on the map (like a tree or rock that you cant bump into) or a scroll (that you can pick up) or a building, that part of it you cant collide with but if you collide with the door part it loads up that seperate map for the interior of the house. How would that be done. Because a tree would have to move with the map but whos to say how that tree knows wether its to be drawn or not and how it moves with the map, stuck to its coordinates but not stuck in one place as you move.
Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 21st Mar 2011 20:36 Edited at: 22nd Mar 2011 01:03
Ok i had a look at that code Rich and its great, but i dont think i understand it as well as i initially hoped i would. As it all seems to make sense but any changes i try and make dont work. For example:

1) I cant make the map bigger. I though i would be able to by reading in more data and making the array bigger but it doesnt work, so i dont understand what im doing to the array to make it fail like that.

2) I cant make it display any more than a few squares at a time. I thought that adjusting the values -2 to 2 would be the key but nothing seems to work.

I obviously dont quite understand it just yet, but im not giving up yet. However a bit of a boost would be nice to point out where i am going wrong.

Then once i am done with this how would i do a tileless one, based on large drawn landscape images with actual objects in place of tiles for things like the trees and houses. How would they move?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Mar 2011 22:13
Quote: "i was talking about the viewpoint, that sort of offset 45degree ish angle"

So was I - that's why I posted the link to a tileset that has its tiles showing everything at 45 degrees. That's why I talked about how to display those kind of tiles (transparency, horizontal offsets etc).

Quote: "How would i put objects on the map"

Impassible objects, like rocks, walls, cliffs, rivers etc, are just a part of the map. Objects that can be manipulated would be held separately from the map, possibly in another array that's also organised and sized in the same way as the map array.

Basically, like Rich has shown you (although I'd make the 'walkable' part of his structure a property of the tile itself, not the map).

Quote: "I cant make the map bigger"

You don't need to. When you get to the point where you are about to walk off the side of the map, you simply load new data into the map (with overlap of course), and move the player to the appropriate position in the map so that they don't appear to have moved anywhere.

Anyway, here's 30 minutes work without media showing an isometric view of a very simple maze (WARNING - using my plug-ins for fill and colour):


Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 22nd Mar 2011 01:15
An advice I'd like to give you and one which you should have already gotten is to "start small". If you haven't already done a basic 2d map and skipping to 2d isometric maps then you're going to have a hell of a time. Most of the skills needed can be learned much easier with the basic 2d map not to mention graphics are also much simpler.

For the purpose of learning you need to take it one step at a time and keep it as simple and cheap as you can.

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 22nd Mar 2011 01:20 Edited at: 22nd Mar 2011 01:33
Thanks Ian. I was doing a few more tutorials on the READ and DATA statement and arrays and such and im thinking im getting the jist of it if only a little. Rich's example moves the character by 1 tile at a time though, is it possible to have my animated sprite from the previous post smoothly scrolling along with those tiles or is that 'algorithm' only for moving the whole map with the character one tile at a time.

In my other sprite moving post i still havent added the code for moving him diagonally smoothly yet with animation but i do know how to, its just i have spent all of today focusing on arrays and the map itself so i can easily finish up my 'player handle' later which i hope to add to the knowledge i get from here and make him smoothly walk through whatever tileset i lay down.

Also after reading up on isometric tiles i think i am starting to understand what you mean by

Quote: "@Somarl,
2D Isometric IS tiling, only there's a horizontal offset for each row (of half a tile), and (usually) a half-tile overlap vertically.

Because of that overlap, you need to paste with transparency enabled."

You would need the horizontal offset because pasting the tile at its own 0, 0 coordinates (on a square bounded box) would be a part of the tile that isnt technically there.
The Half tile overlap is then because when you make a higher tile it will overlap to some extent, a flat tile, like your flat floor tile versus your wall tile, there are parts of that where the wall covers tiles "above" them and to the right. Other than that it works the same as pasting down flat square tiles in an array, the tiles are just drawn differently of course, and not just in a diamondy type shape but also the incorporation of the object on the tile at a different angle.

Please correct me if i am wrong.

Also i did a search a week or two ago about isometric maps on this forum but didnt understand any of it, however now i have a few of my own questions answered on this thread, maybe looking back over them will help further the understanding so i will check them out again.

If anyone has any more good tips and info about the scrolling part in particular then i would love to hear them. Or perhaps other methods of doing things so i can get a broader understanding and choose my own method maybe. Thanks.

Post Edit:
@Ashingda 27 i am at the moment just trying to tie down getting a map to scroll in general but i was looking into isometric just for the sake of it and it seems to be part of this thread now.
I am trying to learn just a little and i think the first place i got stuck was realising i could move a sprite up and down a screen, i could even load a picture for a background but not move that background around with the sprite moving and thats really what started this thread.
I am of course still at a bit of a loss as to where to start but the examples and diagrams and code that keeps pouring in is helping me slowly but surely get to grips with what the hell is actually really happening when you press "d" for move right because moving the character isnt enough now as he will just go to the edge of the screen. Now its about getting the map to move with him. Do you think tiles is the best place to start? I wont tackle isometric for a while yet but perhaps there is something even easier to try first rather than making a tile map, then moving on to that later once i grasp whats going on with positioning the character along the map?

Again folks keep the suggestions/help coming.
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 22nd Mar 2011 03:14
About moving maps and characters it mostly depends on how you display your graphics. There have already been two good examples of displaying 2d tile-based maps, moving a character and even collision.

Once you have your way of displaying your graphics, scrolling or moving them is simply done by increasing or decreasing 2 variables.

Example: Displaying a random map.


Example: Scrolling that same map.


Lost Dragon
14
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 23rd Mar 2011 00:21 Edited at: 23rd Mar 2011 00:25
I have a huge interest in tile engines and am still learning my way through them.

Once you understand what everyone here has said already and have made your own tile demo there are some other premade examples around to look at to see how other people did it in the past.

The main thing I had difficulty with was the concept of having a viewport of a bigger map. As far as I can tell you only want to ever display or do calculations on the tiles that the player can actually see. That allows you to have huge world maps without bogging down your PC.

Anyway, these helped me learn.

http://www.thegamecreators.com/?m=codebase_view&i=0ee878a92195ee8c39c59bc3196e47d1

Pizzaman's scroller has a couple of bugs.

1. Characters can move off the map which crashes the demo. That one is easy to fix.

2. The other bug is with collision on corners. Characters like to get stuck on corners. I was never really able to resolve that 100%. I know it's fixable, but I moved on before coming up with a solution.

Lastly there is also a tile function library in the code snippets board. Once you understand tiles you can try using that too.

http://forum.thegamecreators.com/?m=forum_view&t=117261&b=6

It seems like it was originally designed for an RTS style game.
Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 23rd Mar 2011 02:20
Hey thanks guys. That pizzaman codebase example is exactly how i want mine to move right now. So he can overlap some tiles at a time (which that one can, at one point i had a quarter of him spread over four tiles) rather than moving a tile at a time. Then also the scrolling was smooth. So thats great, i had a read through the code and some of it makes sense so i will have a play around with it hopefully this week and get to grips with it. Couple it with everything people have told me on here and i might be able to crack this.

The principles from each example will hopefully drill in what i need to do in order to achieve what i want.
But if anyone finds anything else please post it up, or any hints from what they were stuck on at the beginning and what helped them through it. Thanks.
Lost Dragon
14
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 23rd Mar 2011 03:59
The next thing you'll want to be able to do is load maps from a data file. Around that time you will also want to come up with an easy way to edit maps.

There are more smooth-scrolling examples around, but I recommend making your very own home-brewed step-movement type tile engine first. You could make a "simple" maze style game with it.

If you use the pre-made examples as a starting point then you will definitely get stuck later on. It is good to start from scratch to learn.
Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 26th Mar 2011 14:46 Edited at: 26th Mar 2011 15:22
Ok, sorry guys but i tried and tried but got stuck again. At the moment i cant even get the map to display. I have read everything i can possibly read (not just on these forums) and just dont get it.

Please will someone set me straight on this point.

This code will not work as i havent finished the paste image command in the displaymap function.



Since this, i have managed to complicate it further by trying to use a UDT to store the x and y co ords and the image number and whether the tile is walkable on or not.

No matter what i do i dont seem to be able to make this work. I guess i just dont understand it enough but im not stupid i just dont understand it for some reason. If someone posted an example with the most rediculously insanely long and verbose variables (so i couldnt not know what they were for or where they came from) along with comments for every line and why this line comes after this line and why what line is coming next is coming next im not sure it would help, yet there is nothing more for me to read. I honestly dont want to pinch someones code and modify it slightly as if i dont understand it i may not even be successful at that, but even if i was i would hate the fact that it is above my understanding so i just have to "drop" it in.

I refuse to go any further in DB till ive cracked this but i have definately hit a wall. All these examples and help and i just cant seem to write my own. And yet on the other hand i refuse to believe that i cant be taught as i understand certain concepts of various disciplines that would make an average guys head spin. A few more weeks of this and its going to be "monitor out of the window" time. What is wrong with me.

I will keep trying on my own till someone replies to this but so far im getting nowhere so please someone help.

Attachments

Login to view attachments
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 26th Mar 2011 16:42 Edited at: 26th Mar 2011 16:54
I happen to be working on a rogue-like, top-down, tile-based game at the moment, so your project is a good example for me to give some help.

I've changed your code just a little bit, but hopefully I've commented it well enough that you can modify it to suit your needs.

This just shows how the different tiles can be pasted on the screen to display the full map.



There's not really a "best way" to write a program. You have to make some decisions before you start coding. (Well, a lot of times I change my mind about how my program works while I'm in the middle of coding it, but that's not efficient )

Since you are new to programming, it's good that you want to try all the different commands and functions. Once you have a good grasp on the tools, then you can pick and choose which ones to use.

If you want to explore how to store map data in a UDT, I'd be happy to help with that. I'm sure others here would help as well.

EDIT: If you are using a different tile graphic than the one I posted earlier, please post it here, and I'll change the above code to match it.

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 26th Mar 2011 16:55 Edited at: 26th Mar 2011 16:59
Cheers Rich, very much appreciated, i nearly have no hair left, just down to the last strands now .
I tried making this work but cant, its a little messed up (well a lot messed up really).
Why do i think i can make this work? I cant seem to get the reasoning in my own head as to why i think a certain combination of this will work. I know what i want to achieve (basically pizzadudes scrolling code mixed with my demo (that does work) of the orge walk - see post on stopping sprite animation)

Here is some code that i am getting myself confused with.
By the way this could be really rough as i am now copy pasting bits of the code out of a full none working version but trying to avoid putting everything in (such as the sprite to move).




Sorry that im being a pain here but for some reason my brain just doesnt want to go with the flow on this one and i cant for the life of me work out how you guys just guessed the right thing to do to make this work with no help at all and a little trial and error, outstanding work.

Edit: Oh and sorry Rich, i cant think what i have done with the tileset but i made the "dude" out of that tileset you posted then reduced it down to 32*32 to fit the new tileset which all the images are 32*32. So yeah that original tileset was 64*64 but i changed it. I hope this makes sense. Did i post the 'new tileset'? Its made up of a lot of images (i was just using water and grass) but they are only 32*32

2nd Edit: What an idiot i didnt post up the new dude or new tileset. Sorry about that, that is not helping get my point across is it. Silly me.

Attachments

Login to view attachments
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 26th Mar 2011 17:42 Edited at: 26th Mar 2011 18:07
Hi Somarl! I'm at work today, and I'm just answering the phone, and nobody is calling, so I've got lots of time to work on this with ya!

I'll download your graphics and revise my code.

So, I've sort of got an idea what you are aiming for...

1. You want the ogre to animate as the player position on the map changes.

2. You want the background to scroll behind the player as the player position on the map changes. I'll look at pizzadude's work to see how you want that to look.

Some other possible design decisions...

Is the game turn-based, or timer-based?

Do you want it top-down, with each location being a square? Or do you want it isometric, with each graphic being a diamond shape?
(I would suggest top-down until you have a thorough grasp of DBPro)

Is the player limited to a grid of x,y coordinates? Or is the movement free form, with the player walking over all the pixel locations?
(x,y grid is easier to code. You can still use the walk animations, even though the player can only be at grid locations)

How much of the map do you want to see around the player?
(The larger the visible area, the longer it takes to "paint" each frame of scrolling.)

What data do you want to store in the map UDT? If you use a 2 or 3 dimensioned UDT, you don't need to store the x and y positions, as they are equal to the index values of the UDT. You certainly want to store the image used for the location, but what else?

Other location attributes to consider...

Movement cost - if you want to use movement points - like say, a road costs 1 movement point to enter, grass costs 2 points, swamp 3 points, etc. The player starts each turn with a set number of points, and once those are used up, it's the monster's turn to move. This can be an alternative to turn-based movement, or as an addition to it.

Blocking - does the terrain block movement. Putting this explicitly in the UDT makes it easy to check, but you can also check against the terrain type itself.

LOS blocking - does some of the terrain block the player's line-of-sight to other terrain or objects?

Terrain height - are some locations higher or lower than others?

Probably others as well, but it helps to know what you want to store before you decide how to store it.

EDIT: Here's revised code, with your graphics.



Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 26th Mar 2011 19:49 Edited at: 26th Mar 2011 20:03
I would like timer based rather than turn based.

I will just do top down for now and worry about the more complex isometric at a later date perhaps. Top down for now will do fine.

While i do want the ogre anim to scroll along with it, i was at first just trying to nail down the basics. At the moment that sprite is far too big for the map i would create so i will have to work on graphics later (plus i dont want to use that ogre one i would like to create my own eventually) but yes for now that is sort of what im after

I wanted the player to be able to move free form across th tiles rather than one tile at a time but i was struggling with either method. I thought i would at least be able to grasp one tile at a time and sort of jump from one tile to the next but i got stuck even on that. However in the end i would like him to be able to move across the tiles such as pizzadudes example shows.

I am not sure at the moment whether i need a UDT or not but i would like to learn how in case i need other info about the tile to be stored but to be honest i dont know what i need.

I would also like a certain "push box" to be around the player, not very big but instead of being completely centred and the map moving round him i would like a sort of mini invisible box that scrolls in the direction when the limit of it has been reached (am i making sense here? I am finding it difficult to explain ) But for now just being centred so i can understand it easier would be fine, then once i grasp it maybe putting the push box in later.

While i dont want it turn based i do like the idea of having certain tiles slow the player down somewhat when walking through them. Hence why i thought i might need a UDT so perhaps a walkable variable could determine not only speed but if it can be waled across at all. So
0 = Not at all (Tree, water)
1 = Slow (Swamp)
2 = Normal (Grass)
3 = Fast (Road)
But i wasnt sure about this. Maybe another thing to consider once i get the rest nailed down.

I would love an LOS, some sort of fog of war type effect but ill settle for anything right now and perhaps implement that later. It would be nice to do a LOS on an isometric map (similar to UFO: enemy unkown back in the day ) but for now i guess i dont need it. Also i would like to know how to create a fog like particle that expands as the character has gone over it but i wouldnt know how to do that so for now i think i could settle with just displaying the map across most of the screen (some to be used for a UI later on), but i need to create a map far bigger than my screen first.

Many thanks for your help Rich, im glad work is not so busy . I love days like that but they simply do not happen. If im not working constantly the company catches fire or someone spontaneously combusts lol, they couldnt do without me

Edit: That above code is great, as i managed to alter it to show me what is going on by doing this:

Which works (till i get to the end of the page of course but i get the point by then its not important), in showing me what tile it is displaying when its pasting them and in what order (y first, x second.)
This is helping me a little (remember for some reason on this im a little slow on the uptake). Map (1,1) from that loop Map(x,y) is 1 because that was the number read into it on the read statement.
PasteX=x*32
PasteY=y*32
Will work by making pastex equal 32 on the first iteration, so paste that image number from Map(1,1) (which is 1) at x*32 which is 1 *32 equalling 1.
So i am just about getting the gist of displaying now. Please keep the help coming, i really really need it
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 26th Mar 2011 21:46
Quote: "That above code is great, as i managed to alter it to show me what is going on by doing this:"


LOL! I often do the same thing to see what tile is what. Try it this way though...



Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 26th Mar 2011 22:45
Thats a nice little trick Rich. I like it. It was good to add a wait key in that first one just to show me how it was drawing the tiles, like what order first and so on. With this aswell its helping me understand.

Now what about scrolling and player movement?

For now i suppose the easiest way would be to centre the player and never move him but create a set of handles (using keystates) to control the direction of the map and scroll that around him?
How would i do this?
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 26th Mar 2011 23:13 Edited at: 26th Mar 2011 23:20
Well, code has already been posted in this thread on how to scroll the map underneath a static, centered player.

But Pizzaman's codebase entry is pretty long, and it's taking me a while to go through it all. It looks like what you want, he combines pixel movement with a data grid map. It's very well commented. If you've studied it, what part of it should I look at?

Oh - one thing with per pixel movement - any sprite animations of walking in one of only 8 directions might seem a bit strange, if the player is not walking in one of those 8 directions. But, if you limit the input to those 8 directions, it's all good.

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 27th Mar 2011 00:41
I was taking a look at Ashingda 27's example and the displaying map bit i get as its pretty much the same as the other one we were working with. Only difference was drawing the map tiles and grabbing the images instead of from a preset tileset, then for creating the map it was just a case of reading random values into the array rather than from a data statement. Other than that it is the same so it has helped me understand displaying the map further.
But when it comes to the scrolling part i cant fathom how its done.

Using Ashingda 27's example i see some things that confuse me:

1) ScrollMapY# and X are just declared from nowhere. What value are they, how are they done this way. I know you dont have to declare every variable but is this right (i mean of course it is because the example works but how is the question)

2) CheckX = lpx+int(ScrollMapX#)
CheckY = lpy+int(ScrollMapY#)
I am not too comfortable with either. Why have the ScrollMapY# increased or decreased by a decimal then convert that into an integer. You cant move an x or y value less than 1 anyway because you cant have 0.1 of a pixel. Why bother declaring it as a float anyway, then just to convert it back to an integer with int(Scrollmapx#)
Also i cant follow this because i dont know what value ScrollMapY & x are meant to be. Is it 0? So the first iteration would be as follows:
CheckX = 0 + 0 - becuase lpx is 0 and scrollmap would be 0?

3) This also trips me up. I know the code but not what it is doing.

if CheckX > -1 and CheckX < MaxMapX and CheckY > -1 and CheckY < MaxMapY

Is this to stop something going off screen? I am not 100% sure what this does and without the values i cant work it out.

Once i get past this hurdle its on to the next one. Its fun but frustrating at the same time, i wish i just knew it so i could get on with making a game. Ive been at this scrolling for a month now (2 months into DB) I learned so much in the first month and now its slowed right down lol. But with help and a lot of patience from guys like you ill get there in the end
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 27th Mar 2011 03:59 Edited at: 27th Mar 2011 04:05
In Ashingda 27's code, ScrollMapY# and X are used to control the speed of scrolling. Ash says as much in the comments. They start at zero and change by Speed# when keys are pressed. The funny thing about that, is that it really shouldn't work. The INC and DEC commands call for integers, or at least that's what the help files say. I guess INC and DEC work with floats too though.

EDIT: My bad, I didn't read all the way through the help in INC and DEC. Part of it says integer, part says they can use either integers or reals.

The floats are converted into integers as they increase or decrease. A key must be held down for 10 times through the loop before it changes by "one pixel", thus delaying the scroll.

The CheckX and CheckY stuff is to keep inside the bounds of the array. The array dimensions run from 0 to 29 (MaxMapX and MaxMapY are set to 29 as well) so Ash is checking to make sure the values are more than -1 and less than 29.

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 27th Mar 2011 13:00 Edited at: 27th Mar 2011 13:34
Thats great Rich, thanks. It confused me a little. I knew that ScrollMapx# and Y were being incresed or decreased by the value of speed but didnt know what value they were as i hadnt seen them stated anywhere else, now i know they started at 0 i might be able to follow the code a little better.
The decreasing/increasing by 0.1 threw me off a little as it did yourself then i was confused as to the integer change but its to slow down the scrolling, this is a good method rather than having it just inc or dec by 1 every "cycle". I didnt know it would work like this. Just to go a litle further in that though (as i am still al little confused), wouldnt the int(ScrollMapX#) just return a straight 1 or 0 regardless of what the float was as i always thought it just round straight up. So the second it is 0.1 its 1. When its 0.2 its 1. And not 0.1 - still 0, 0.2 still 0 etc etc up till 0.9 - still 0, 1 - move by 1.
(Sorry the above is very poorly wrote out, its difficult to explain things in writing i find.)

I get it which is the main point, i was just wondering how that int() works as the help file is throwing me off with statements like.
print floor(-1.23) :` -2
print ceil(-1.23) :` -1

Why would floor be -2 and ceil be -1? How does this command round up or down when that value is the same but it is randomly picking whether it returns a -1 or -2.

I wonder also how one would do this with a UDT array. I am going to work on what i understand so far to get the scrolling working but once i get that i will probably want to do it with a UDT and also i would want to learn blocking the player on certain tiles or slowing them down etc.
Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 27th Mar 2011 14:18
This is what i have come up with so far, and it partially works but i cant get the equivelant Ashingda 27 examples checkX to stop the map from going way out of bounds and pasting where it shouldnt be pasting. Please check it out and tell me whats happening so i can fix it.



So this is how far i am so far, not quite there but just get over this one and im ready to place a player down, hopefully as a sprite and hopefully with animations, if anyone has any help i would appreciate it because at the moment my playerhandle (which is from the stopping sprite anim thread) does not work properly when inserted into this code.

Many thanks.

Attachments

Login to view attachments
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 27th Mar 2011 16:44
Quote: "I get it which is the main point, i was just wondering how that int() works as the help file is throwing me off with statements like.
print floor(-1.23) :` -2
print ceil(-1.23) :` -1"


Because -2 is less than -1.23 and -1 is greater than 1.23

That example might be easier to grasp if it wasn't just using negative numbers, but it does show how the functions work.

int() returns an integer value

floor() and ceil() return real/floating values

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 27th Mar 2011 17:31
Yeah but both of those number are the same. How can -1.23 return a -1 then return a -2. Its the same number. Surely it would be the same all the time, either -1 or -2, whatever it wants to pick but the number is the same. It cant just decide to say `right for this variable i am going to return a -1 because i feel like -1.23 should be -1 today.` Then on the next line just say, `right theres -1.23 again, this time i think i will make it return a -2.`

The example that shows positive numbers is exactly the same. In one instance it returns 1 the next on the same number it returns 2.
print floor(1.23) :` 1
print ceil(1.23) :` 2
1.23? Its the same number. Surely its the same number. What am i missing. Unless of course the `1 and `2 is not the number returned by the program, which in that case what on earth is that for, its only gone and confused me as i thought it was telling me what the result of running that would be.

Anyway for now ill just take it for granted that it works because it does work in that code (and i really want to get this scrolling demo cracked so i can move on to thnigs like adding enemies and objects - but ill start a new thread for that when i can move the char around a tiled map) but i am stuck on the rest of the scrolling method now. That example i posted doesnt seem to work when it goes out of bounds so ive got a digit wrong somewhere but ive tried many combinations but its eluding me as of now.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 27th Mar 2011 18:46
Quote: "I knew that ScrollMapx# and Y were being incresed or decreased by the value of speed but didnt know what value they were as i hadnt seen them stated anywhere else, now i know they started at 0 i might be able to follow the code a little better. "


Just to let you know. Any variable when it's used for the first time if it isn't defined that first time automatically start at zero. Strings used for the first time start out as empty. Arrays are the same starting out as all zeros for numbers and empty for strings.

Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 27th Mar 2011 19:27 Edited at: 27th Mar 2011 20:01
Quote: "The example that shows positive numbers is exactly the same. In one instance it returns 1 the next on the same number it returns 2.
print floor(1.23) :` 1
print ceil(1.23) :` 2
1.23? Its the same number. Surely its the same number. What am i missing. Unless of course the `1 and `2 is not the number returned by the program, which in that case what on earth is that for, its only gone and confused me as i thought it was telling me what the result of running that would be."


Well, you are missing the point a bit. FLOOR() and CEILING() are functions that change the value they are given. FLOOR() drops the floating point value down to the nearest lower whole number, and CEIL() bumps the value up. Both of them return a floating point number. INT() does the same thing as FLOOR(), but returns an integer value.

Why and when you would use those functions depends on what you are trying to do.

In this case, I think the logic goes something like this:

Moving the player 1 pixel every time through the loop is too fast.

Instead, wait for a key to be held down ten times in a row through the loop, then move the player, then reset the counter of how many times the key has been held down through the loop.



There other ways that this could be accomplished, but that's the way Ash did it.

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 27th Mar 2011 19:36 Edited at: 27th Mar 2011 19:46
Deleted as i repeated what i said earlier but now understand it, i thought my post had vanished.

`````````````````````````````````````

While waiting for help i decided to look around on the forums and came across mappy for win32. Its such an excellent little program that allows you to put a map together very quickly but the text export is crap and requires a lot of fiddling to get the map to read right. However its possible and a damn sight more fun than drawing tons of numbers into a read statement. Just copy paste and edit out what you dont need, its fantastic. I tried it with my tileset that i pinched (and added a few crappy tiles of my own) made a small map and am trying to display it. Only thing i am having a problem with is going through the tileset using a for loop and get image. To save me from having to write each line out for get image on each of the 64 tiles, but cant think how to do so. I get stuck whichever way i do it. Be it looping through 8 x and 8 y values (by which i cant get the image number to be right) or just loop 64 times through a variable which does the 'Get Image a' bit right but i havent a clue how to make it start at the right x and y then loop through. How on earth do you work this out.

Example, this is how far i got but it is not right.

Load Image "Tilset.bmp", 1
For x = 0 To 8
For y = 0 To 8
Get Image X+1, X * 32, X * 32, X * 32 + 32, Y + 32 ` None of this is right, i dont even know what im doing Y +32? thats never going to work.
Next y
Next x


And

For a = 0 To 63
Get Image a+1, ` Not a clue what to put here to increase the iteration in regards to x and y on not one but 8 rows.
Next


Although this is somewhat a step back from my original problem that i am stuck on, i would like to know this as well as it will help me build a bigger map later on down the line.

Edit:
Just worked out how to post the right image number through the iteration.

Load Image "Tilset.bmp", 1
a = 1
For x = 0 To 8
For y = 0 To 8
Get Image a, X * 32, X * 32, Y * 32 + 32, Y + 32
Inc a
Next y
Next x
I think will work, but the code for cycling through the bitmap and grabbing the right images is wrong. Not sure how to do it.
Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 27th Mar 2011 19:38 Edited at: 27th Mar 2011 19:42
Nice. I like how it sends you back to the first page making you think your post is lost. Deleted this original rant.

Edit: Just going to edit this post rather than start a new one. Cheers Rich, i know get what that Int is doing.
I though Floor and Ceil were just some random variables, if you think like that you can understand where i am coming from. Instead i now know they are changing the floating point so the int of that value will be different. Sorry about that then guys but i had no way of knowing.
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 27th Mar 2011 19:59
Quote: "Load Image "Tilset.bmp", 1
a = 1
For x = 0 To 8
For y = 0 To 8
Get Image a, X * 32, X * 32, Y * 32 + 32, Y + 32
Inc a
Next y
Next x
I think will work, but the code for cycling through the bitmap and grabbing the right images is wrong. Not sure how to do it. "


This is almost right. Your GET IMAGE line should be
Get Image a, X * 32, Y * 32, X * 32 + 32, Y * 32 + 32

I haven't used mappy, but I will check it out. Sounds like will save you a bunch of time eventually.

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 27th Mar 2011 20:23 Edited at: 27th Mar 2011 20:39
Oh yeah Rich, its a really good little program. The amount of fiddling in the text file afterwards is well worth it as you get a considerable boost to the overall design. I am not sure how i would cope trying to visualise the map as numbers. This program is great, someone has linked it before but ill link it here
http://www.tilemap.co.uk/mappy.php

Damn the code for cycling through and grabbing images is so simple. Combined with mappy it should be easy to construct a large map with ease. I just wish i could draw so i could do good tilesets but ill have to make do with whatever i can get my hands on for now plus knock up poor versions of whatever i cant find. Still this is the stuff.

Now i need to try and get the character displayed on the map and moving around with the scroll but as i mentioned before 2 things are sort of in the way.
1) The playerhandle i created before works great but the ogre sprite is way too large for that map so not sure whether using it is going to impact it till i find a way to get smaller characters (or i could just reduce the bmp for the ogre to fit the 32 tiles.) Anyway, regardless of this when i import my playerhandle all of a sudden it doesnt work as expected. He constantly turns east whenever you stop moving him, which it didnt when it is on its own.

2) shouldnt i be trying to keep the character constrained anyway as he is not technically moving round the map but the map is moving round him? Does my playerhandle now somehow have to merge with the map commands? If so, then how (at a later date) could i add a little 'push box' for him to walk around in so when you are at one corner it scrolls up, if you turned the opposite way he would move down and not move the map but the character for a very short distance then start pushing the scrolling map again. Again sorry for the p poor explenation i hope someone understands what i am trying to do here in both cases.

Edit: and this is how far i got with the code so far.

Unfortunatley it doesnt work but in all fairness i have tried every combination i can think of.


This just rings out illegal image numbers at line 45 which for me is Paste Image Img,x,y, cant think why that is but i have tried changing all the variables to something else even making the array 1 bigger for x and y, then moving all the values to 23 and 13 instead of 22 and 12. If anyone can help me understand what i am missing here and the way my brain is thinking this will do i would appreciate it. All this, 200 hours over the last 4 weeks and 32 posts and i still cant make a damn character scroll on a map. Oh well. As long as im getting help i guess there is no point giving up completely just yet.
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 27th Mar 2011 21:32
Gee, I hope that's not the code you are using.

Those first 12 lines should all start with DATA, not READ.

Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 27th Mar 2011 22:12 Edited at: 27th Mar 2011 23:02
Whoops, my bad
Changing that. I got a little excited.

Ok i got a little out of bounds error at first which i managed to fix. It does now compile but doesnt show. I shoved a Sync in there but to no avail.



Throwing in your little trick to show whats what and where on the map is showing it to be working, its just not displaying the tiles.



Something else i spotted was it was trying to load "Tilset" not "Tileset", now i wonder why that didnt crash i as i dont have a file called that in my project folder and i thought it would have crashed with that statement if it couldnt find the pic, it always does. Anyway, regardless it still isnt working but i added a paste image 1, 0, 0 to see what it thinks image 1 should be (it should paste some water at the top left corner) and it doesnt paste it, so the code is wrong there i think but im not so sure.

15th Edit:

I am using this:

To check which image it thinks 1 is. Now i also changed the for loop to start from 0 to 8 as i dont understand how that for loop could work as it needs to start from 0, 0.
32 * 1 is not 0, so it must start with 0 so it can be X(0) * 32 (which will equal 0) Surely this is the right way to do it? Or did it work better when it was 1 To 8?
Either way its still not working so ill keep looking at it.

254th Edit:
Ok i now changed it to this as i was sure the For loop wasnt working and this shouldnt be right, i was silly to leave it that way so here is the revised code......althoughitstilldoesntwork.



603rd Edit:

Ok now i take back everything good i said about Mappy. I wondered why the data statements didnt feel right. All in the top left corner should be water surrounded by a crappy embankment tile i made, but instead its all made up of 50's and 60's and so on. This isnt right. It got the grass right but other things its gone nuts on. Maybe this can be fine tuned somehow but i havent got a clue how to do it so now i have no way of exporting all those numbers into a pretty little data statement, so large maps will be a very painstaking process, very painstaking indeed.

Further more at least i figured out how to make the thing work. After all i hadnt pasted the image (the main tileset) then cls'd it when i gathered the info. So at least it now works.

Right who wants to help me with getting a character on there !

8 Millionth to the power of 5 Edit:

Mmmmm it seems that mappy is ok after all. It is doing as requested. The image numbers are getting mixed up but only some of them. I am not sure how this could be happening as if you cock one up you cock them all up is what i say. You cant get the grass tile right and not the rest, and thats the only one thats right. So i am wondering if its something to do with the garbbing image part. I am going to experiment a while (cause i have tons of time and dont want to get moving on to something interesting at all!), i will figure it out and post up the full working version on here. Then will someone help me with the moving character

Infinity Edit:

Yes i got it working. Take a look at this. My apologies to the creators of Mappy i will remove the voodoo curse from your families immediately, i hope not many folks died.



Screeny Attached!

Now onto the character

Attachments

Login to view attachments
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 27th Mar 2011 23:22 Edited at: 27th Mar 2011 23:34
Okay, looking good so far, glad you are keeping at it!

How are you getting the data out of mappy? If you haven't done so already, I've attached a file that you can drop in to the luascr folder in mappy. It replaces the flash export script, so that when you use that script a text file is created with all your DATA statements.

EDIT: Just a quick mention - in your DisplayMap() function, you don't need to check for lpy and lpx being out of bounds, since you explicitly loop them from 1 to 12 and 1 to 22. Aside from that...

CONGRATS!

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-22 23:25:50
Your offset time is: 2024-11-22 23:25:50