|
mappy and collision removal |
rxtype
Member #8,352
February 2007
|
hey, ive searched the forums and found a lot of questions and answers relating to mappy, but i couldnt find anything that solves my problem. i have a map made with mappy, with 3 different block types. here is a sample map the player starts off on the left side and needs to make it across to the right side. now my problem arise, how do i code it so that SPACE removes the grass and changes it to a normal block 1(land)? thanks |
Jeff Bernard
Member #6,698
December 2005
|
You've got an array on intetegers, right? (I've never used Mappy). Just change the value: if (tile_that_is_faced_is(2) // if you are facing the grass tile && key[KEY_SPACE]) // if you press the space key { map[that_tile] = 1; // change it to land update_map_graphics(that_tile, 1); // if you need run a special function to change that tile }
-- |
rxtype
Member #8,352
February 2007
|
nope, its not on an array, the map is actually loaded as a .fmp file.. |
William Labbett
Member #4,486
March 2004
|
I can't really help but perhaps the .fmp file format wasn't really meant to be writable. You either need to find out how to change the info in the .fmp which might require some help from whoever wrote mappy or write your own level editor which for the type of thing you're doing is dead easy :- For example you could have a little bitmap. Choose a colour for each tile type you have. Load the bitmap. Declare a 2D array tiles[MAP_WIDTH][MAP_HEIGHT] then read the bitmap and write the array :
then you've got an array with the type of tile in and you can change it's Sorry if that's patronising - maybe you're keen to make use of Mappy in which case you need to learn about the .fmp format so that you can copy the map info into an array like above.
|
rxtype
Member #8,352
February 2007
|
ok! |
|