Anuncios Google

Tile-Map-Engine in PGE LUA!

Hey Guys,

im working on this Homebrew:

http://psp.scenebeta.com/noticia/pspokemon-grey

But i cant add new maps!

I tried many things, but i always fail :x

Also i have problems with the collision on the new maps, so could someone explain me how i can add new maps in this homebrew?

 

Or even better, could someone show me how to code a tile-engine(16x16) in PGE ?


Anuncios Google

Opciones de visualización de comentarios

Seleccione la forma que prefiera para mostrar los comentarios y haga clic en «Guardar las opciones» para activar los cambios.

You can use a predefined 2D

You can use a predefined 2D array, each value is a tile, for example "1" is grass, "2" is ....

And then by using math.ceil and math.floor (for integer aproximation) you can check the collisions, for example:

If you are on  [2][4] and in [1][4] there's a rock, then there's a collision if the player tries to go up.

Could you explaine me the

Could you explaine me the part with math.ceil& math.floor a bit better or make an example to it ?

 

PS: Thanks for your help.

Well, that's because your

Well, that's because your player can be on 4 tiles at the same time, for example if it is on the coordinate X 4.34 your player may be at tile 4 and 5, so with math.floor you get the number 4 and with math.ceil you get the number 5.

Thats another problem, my

Thats another problem, my player can go how he want and not like in real pokemon games just in 4 Directions, because if he would go like in real pokemon games, it would be much easier for a map system, also i cant make a camera like in pokemon which always stays with the player and wenn the player moves the camera moves to, because that would be great, also a wanted to amke a tile-engine with 3 numbers like if player.x and ... = tilenumber1 then the player can go on all places wich are tilenumber1 if its tilenumber2 he cant go to that place and if its tilenumber3 he will come to another map when he goes on that tile, something like that would be amazing ... 

Imagen de NEKERAFA

Mmm...

math.floor()  takes the floor or round down and math.ceil()  takes the ceilling or round up. However, you can round to nearest with a home function (Available in LuaDEV):

function math.round(number)
   number = tostring(number)
   if tonumber(number:match("%.(%d)")) >= 5 then return math.ceil(tonumber(number))
   else return math.floor(tonumber(number)) end
end

Greetings ^-^

P.D: Sorry for my english, I think that it's a bit bad.


NekeOS, el nuevo shell para PSP

PS4 500GB OFW, PS3 320GB OFW, PS3 500GB OFW, PSP 6.39 PRO-C Fix4.

Sony Xperia Z1 Compact con Android 5.1.1

Portatil Lenovo z50-70 Intel® Core™ i7-4510U y NVIDIA GeForce 840M con Elementary OS 0.3.2 Freya (64 bits) y Windows 10 (64 bits).

Then how i manage to make my

Then how i manage to make my player go like this:

http://www.youtube.com/watch?v=AXH2epi4GBw

its not very smooth, but that how people in pokemon go !

 

Imagen de NEKERAFA

Mmm...

I think that I know you said.

You must blit the map with the position of player in the middle of it and blit the sprite player in the middle of the screen. In order to do this, you can use a for bucle.

Example in a small map with 10x10 tiles of size 16x16:

1 is a obstacle

map = { {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
   {1, 0, 0, 1, 0, 0, 0, 1, 0, 1},
   {1, 0, 0, 1, 0, 1, 0, 1, 0, 1},
   {1, 0, 1, 1, 0, 0, 0, 1, 0, 1},
   {1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
   {1, 0, 0, 0, 0, 0, 0, 1, 0, 1},
   {1, 0, 1, 1, 1, 0, 0, 1, 0, 1},
   {1, 0, 0, 0, 1, 1, 1, 1, 0, 1},
   {1, 0, 0, 0, 1, 0, 0, 0, 0, 1},
   {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
   obstacle = Image.load("obstacle.png"),
   normal = Image.load("normal.png")
}

Definition of player:

player = {x = 5, y = 5, image = Image.load("player.png")}

Now I suppose (it isn't true) that screen can show 5 tiles only. So radio between out of screen and middle of screen are 2,5 tiles or 3 tiles counting the middle tile.

 -- More code...
 
for mapy = -2, 2 do -- I use this form to add to position player
   for mapx = -2, 2 do
      if map[player.y+mapy][player.x+mapx] == 1 then
         map.obstacle:blit((mapx+2)*16, (mapx+2)*16)
      elseif map[player.y+mapy][player.x+mapx] == 1 then
         map.normal:blit((mapx+2)*16, (mapx+2)*16)
      end
    end
end
 
-- More code...

Then I blit the player in the middle of the screen and I move it if I press one arrow key:

 -- More code...
 
player.image:blit(232, 128)
 
if pad:up() then player.y = player.y-1
elseif pad:down() then player.y = player.y+1 end
if pad:left() then player.x = player.x-1
elseif pad:right() then player.x = player.x+1 end
 
 -- More code...

Greetings ^-^

P.D: Sorry for my ortography errors, I don't usually speak in english and less write long texts, :)


NekeOS, el nuevo shell para PSP

PS4 500GB OFW, PS3 320GB OFW, PS3 500GB OFW, PSP 6.39 PRO-C Fix4.

Sony Xperia Z1 Compact con Android 5.1.1

Portatil Lenovo z50-70 Intel® Core™ i7-4510U y NVIDIA GeForce 840M con Elementary OS 0.3.2 Freya (64 bits) y Windows 10 (64 bits).

Also thanks for your help :D!

Also thanks for your help :D!

Could you tell me where in

Could you tell me where in the code you managed that the player cant go through te obstacle ?

And i want to tell you that im using 480x272 MAPS in pokemon grey, how can i use bigger maps, make the player move like pokemon AND got the camera function ?

 

Imagen de NEKERAFA

Mmm...

If you want to learn to program, you will must do it yourself. We can only tell you some suggestions or examples, or fix some errors. I told you a way to do that you want...

If you use 480x272 maps or bigger, you need calculate how much tiles must appear in the screen.

480÷16 = 30
270÷16 = 17

Map and player:

map = {
   {1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1},
   {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1},
   {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1},
   {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1},
   {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1},
   {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,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 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0},
   {1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1},
   {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1},
   {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1},
   {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
   {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
   obstacle = pge.texture.load("obstacle.png"), normal = pge.texture.load("normal.png")
}
 
player = {x = 16, y = 16, image = Image.load("player.png")}

I show map:

 -- More code...
 
for mapy = -14, 15 do
   for mapx = -8, 8 do
      if map[math.floor(player.y+mapy)][math.floor(player.x+mapx)] == 1 then -- For do a low movement
         map.obstacle:activate()
         map.obstacle:draweasy((mapx+14)*16, (mapy+8)*16)
      elseif map[math.floor(player.y+mapy)][math.floor(player.x+mapx)] == 0 then
         map.normal:activate()
         map.normal:draweasy((mapx+14)*16, (mapy+8)*16)
      end
    end
end
 
-- More code...

I show the player and move it:

 -- More code...
 
player.image:activate()
player.image:draweasy(232, 128)
 
if pge.controls.pressed(PGE_CTRL_UP) and map[math.floor(player.y-0.2)][math.floor(player.x)] == 0 then player.y = player.y-0.2
elseif pge.controls.pressed(PGE_CTRL_DOWN) and map[math.floor(player.y+0.2)][math.floor(player.x)] == 0 then player.y = player.y+0.2 end
if pge.controls.pressed(PGE_CTRL_LEFT) and map[math.floor(player.y)][math.floor(player.x-0.2)] == 0 then player.x = player.x-0.2
elseif pge.controls.pressed(PGE_CTRL_RIGHT) and map[math.floor(player.y)][math.floor(player.x+0.2)] == 0 then player.x = player.x+0.2 end
 
 -- More code...

Greetings ^-^


NekeOS, el nuevo shell para PSP

PS4 500GB OFW, PS3 320GB OFW, PS3 500GB OFW, PSP 6.39 PRO-C Fix4.

Sony Xperia Z1 Compact con Android 5.1.1

Portatil Lenovo z50-70 Intel® Core™ i7-4510U y NVIDIA GeForce 840M con Elementary OS 0.3.2 Freya (64 bits) y Windows 10 (64 bits).

I know that i must code it

I know that i must code it myself, but why do you write  

obstacle = pge.texture.load("obstacle.png"), normal = pge.texture.load("normal.png")
after the map thing ?IM using a 480x272, so i dont need tiles, so do i need that ?

Imagen de NEKERAFA

Mmm...

Ah!, I don't know that you're using a complete map... but it's the same code.

And sorry, I use LuaHM and Lua PGE in the example, I don't usually program in Lua PGE, jejeje


NekeOS, el nuevo shell para PSP

PS4 500GB OFW, PS3 320GB OFW, PS3 500GB OFW, PSP 6.39 PRO-C Fix4.

Sony Xperia Z1 Compact con Android 5.1.1

Portatil Lenovo z50-70 Intel® Core™ i7-4510U y NVIDIA GeForce 840M con Elementary OS 0.3.2 Freya (64 bits) y Windows 10 (64 bits).

So i use this

So i use this Picture:

 

Then the MAP is like this, right ? :

(It looks better when you copy the code and past it into notepad++)

map = {
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
}

Then the next step would be :

for mapy = -14, 15 do
   for mapx = -8, 8 do
      if map[math.floor(player.y+mapy)][math.floor(player.x+mapx)] == 1 then -- For do a low movement
         map.obstacle:activate()
         map.obstacle:draweasy((mapx+14)*16, (mapy+8)*16)
      elseif map[math.floor(player.y+mapy)][math.floor(player.x+mapx)] == 0 then
         map.normal:activate()
         map.normal:draweasy((mapx+14)*16, (mapy+8)*16)
      end
    end
end

 

But what must i change on that to make use it for the picture above, the 480x272 map, and not for a real tiled map ???

 

Imagen de NEKERAFA

Mmm...

Then, It's more easy.

map = { 
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 
{1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1}, 
{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, 
{1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1}, 
{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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
image = pge.texture.load("map.png") -- I load the map
}

Now, you need only show the map:

map.image:activate()
map.image:draweasy(0, 0)

Greetings ^-^


NekeOS, el nuevo shell para PSP

PS4 500GB OFW, PS3 320GB OFW, PS3 500GB OFW, PSP 6.39 PRO-C Fix4.

Sony Xperia Z1 Compact con Android 5.1.1

Portatil Lenovo z50-70 Intel® Core™ i7-4510U y NVIDIA GeForce 840M con Elementary OS 0.3.2 Freya (64 bits) y Windows 10 (64 bits).

Then i dont need this: for

Then i dont need this:

for mapy = -14, 15 do
   for mapx = -8, 8 do
      if map[math.floor(player.y+mapy)][math.floor(player.x+mapx)] == 1 then -- For do a low movement
         map.obstacle:activate()
         map.obstacle:draweasy((mapx+14)*16, (mapy+8)*16)
      elseif map[math.floor(player.y+mapy)][math.floor(player.x+mapx)] == 0 then
         map.normal:activate()
         map.normal:draweasy((mapx+14)*16, (mapy+8)*16)
      end
    end
end

 

Just this:

map.image:activate()
map.image:draweasy(0, 0)

 

Then where do i define that one tile is just 16x16 big ???

The PSP dont know that automaticly, right ?

 

the last step have to be changed to, right ?

player.image:activate()
player.image:draweasy(232, 128)
 
if pge.controls.pressed(PGE_CTRL_UP) and map[math.floor(player.y-0.2)][math.floor(player.x)] == 0 then player.y = player.y-0.2
elseif pge.controls.pressed(PGE_CTRL_DOWN) and map[math.floor(player.y+0.2)][math.floor(player.x)] == 0 then player.y = player.y+0.2 end
if pge.controls.pressed(PGE_CTRL_LEFT) and map[math.floor(player.y)][math.floor(player.x-0.2)] == 0 then player.x = player.x-0.2
elseif pge.controls.pressed(PGE_CTRL_RIGHT) and map[math.floor(player.y)][math.floor(player.x+0.2)] == 0 then player.x = player.x+0.2 end
 

 

Imagen de NEKERAFA

Mmm...

The last step must be the same. It's in the blitting of map. I'm sorry, I lost to define the movement of map:

map.image:activate()
map.image:draweasy(math.floor(player.x)-15, math.floor(player.y)-8)

And only you must edit the player definition:

player = {x = 15, y = 8, image = pge.texture.load("player")}


NekeOS, el nuevo shell para PSP

PS4 500GB OFW, PS3 320GB OFW, PS3 500GB OFW, PSP 6.39 PRO-C Fix4.

Sony Xperia Z1 Compact con Android 5.1.1

Portatil Lenovo z50-70 Intel® Core™ i7-4510U y NVIDIA GeForce 840M con Elementary OS 0.3.2 Freya (64 bits) y Windows 10 (64 bits).

Okey i make everything like

Okey i make everything like you said, even changed the code a bit to make it work with my code, but know when i start the game the map shows for 1 second and before i can make something,  an error appears.

The Error says "attempt to index global ´mypoke´ (a nil value)", but ot worked before and before i added your code mypoke wasnt showed as a nil value .... what di i do wrong ?

I uploaded that bug version for you :

 http://code.google.com/p/pspokemon-grey/downloads/detail?name=PSPokemon%20Grey%20BUG%20VERSION.zip&can=2&q=

Imagen de NEKERAFA

Mmm...

Where you define mypoke table? You must define mypoke before this function.

Why must i define mypoke

Why must i define mypoke before this function ?

I define mypoke, when the player choose a pokemon, not direct when the game starts or t he player press NEW GAME ... so why must i define it before this function ?

I dont use mypoke so soon, you can understand it when you look at the code of Beta r3 ... so why must i define it before ?

Why does the error show up, whenthe function with mypoke isnt needed and so on ?

Imagen de NEKERAFA

Mmm...

You must define before because you are using mypoke but it isn't exist, or you should put also a condition in order to try if the variable exist...


NekeOS, el nuevo shell para PSP

PS4 500GB OFW, PS3 320GB OFW, PS3 500GB OFW, PSP 6.39 PRO-C Fix4.

Sony Xperia Z1 Compact con Android 5.1.1

Portatil Lenovo z50-70 Intel® Core™ i7-4510U y NVIDIA GeForce 840M con Elementary OS 0.3.2 Freya (64 bits) y Windows 10 (64 bits).

So where in the code did you

So where in the code did you define that one tile is 16x16 big ? :X

Opciones de visualización de comentarios

Seleccione la forma que prefiera para mostrar los comentarios y haga clic en «Guardar las opciones» para activar los cambios.