Extra Features for the map editor
-
Being able to change tiles in real-time while the map is running is not really how maps are designed to work. You can do that kind of thing now by adding an additional array of image numbers and drawing them using drawImage or drawImageEx. People have been creating entire games this way without using maps at all since before the first update you could not use your own images as tiles in the map.
-
@Martin is quite right, the way to do this is to use an array of tiles and drawSheet. I've been looking at this recently actually and I'm putting together a demo on doing exactly this.
-
@Dave - I'm thinking that you could initially have your map, which is static data and any associated collision areas and any tile that will need to be changed during gameplay could be left out of the map. Then you could have an additional image as a draw target and render the extra tiles to that. The second image would be drawn on top of that map. Would that work?
There may be instances where it would not cover every eventuality but I bet it would cope with most.
-
I've had exactly the same thoughts too @Martin. I think that's the way you would combine the map editor functionality with animated tiles. It's quite a tricky thing to do, and personally I would use drawSheet and arrays to do the entire map for simplicity's sake - but if your tile sheet has different tile sizes, this gets really difficult fast.
You wouldn't even need to leave the tile out of the map, as long as you were drawing the other tile "over" it it would look correct.
I'll have to get a demo together to demonstrate this, but it's going to take some learning first!
-
Oh, not saying I couldn't do this manually. I've already planned it out for my port. It's more of a CPU issue because the more tiles that have to be processed, the more iterations would need to be done. But, I guess what I assumed was that displaying a map would be faster because it's done internally, because I've come to the realization after trying it that it isn't actually the case because the map doesn't work the same way as manually laying out tiles to form an image. It's more object-based, that each tile is an object (which btw, if you button-press the left stick while the cursor is over an object, it causes problems for FUZE). So even if the request was fulfilled, using maps may not be the best approach for me anyways.
-
@Dave Hi! Did you ever manage to put together that demo? This is exactly what I want to do! I want to make a driving game where the car always faces the top of the screen and the background rotates around it.
-
@Jack_Blue one way i'v thought up, have your map set out with your bends but have a sprite image half way to act as the horizon moving and set to your players -y speed, you could even track the x movement to change horizon states.happy to help if you want me to throw a test of this idea iv got a similar technique i use in another program
-
@waldron That could be cool, but what I really want to do is to have a view of the car and the map from above (like in GTA Chinatown Wars). I think I might be too ambitious here; I've only been using Fuze4 for a few weeks, and I'm still getting used to the commands! I might give up on this project for now and try to walk before I run!
-
@Jack_Blue that would actually be a lot easier and even tho your only a week in make a start on it and update it as you learn.i can put together a program you can build from i'm wanting to set up programs in all different styles anyway and haven't done one like this yet.
-
@waldron That would be fantiastic, if you could!
I actually managed to get this particular bit down (rotating the map around the car), but I don't know how to share my code... I'll type out the important bits! What I'm doing is moving the map's coordinates at the same rate as I'm rotating the image
car_x: the top-left corner of the car image (x) car_y: the top-left corner of the car image (y) car_ctr_x: the centre of the car image (x) car_ctr_y: the centre of the car image (y) car_width: the width of the car image (scaled) car_height: the height of the car image (scaled) map_x = the top-left corner of the map (x) map_org_x = the origin of the map (where it'll be drawn from) (x) = 0 map_org_y = the origin of the map (where it'll be drawn from) (y) = 0 ... etc. IMPORTANT: map_x = car_ctr_x map_y = car-ctr_y car = [ .image = car_image, .x = car_x, .y = car_y, .ctr_x = car_ctr_x .ctr_y = car_ctr_y, .width = car_width, .height = car_height .turning_speed = 5 ] map = [ .image = map_image, .width = map_width, .height = map_height, .scale_x = map_scale_x, .scale_y = map_scale_y, .x = map_x, .y = map_y .org_x = map_org_x, .org_y = map_org_y, .orientation = map_orientation ] loop clear() ctl = controls(0) steering(ctl) drawImageEx(map.image, map.x, map.orientation, map.scale_x, map.scale_y, 1, 1, 1, 1, map.org_x, map.org_y) drawSheet(car.image, 0, {car,x, car,y, car.width, car.height}) update() repeat function steering(ctl) if ctl.zl and not ctl.zr then if (map.orientation + car.turning_speed) > 360 then map.orientation = (map.orientation + car.turning_speed) - 360 else map.orientation += car.turning_speed endif if ctl.zr and no ctl.zl then if (map.orientation - car.turning_speed) < 0 then map.orientation = 360 + (map.orientation - car.turning_speed) else map.orientation -= car.turning_speed endif endif return void
-
@Jack_Blue if you surround your code with ``` it will display the code better (I have done it for you)