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 ?
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 ...
Mmm...
math.floor()
takes the floor or round down andmath.ceil()
takes the ceilling or round up. However, you can round to nearest with a home function (Available in LuaDEV):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 !
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
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.
Then I blit the player in the middle of the screen and I move it if I press one arrow key:
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 ?
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.
Map and player:
I show map:
I show the player and move it:
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 ?
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++)
Then the next step would be :
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 ???
Mmm...
Then, It's more easy.
Now, you need only show the map:
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:
Just this:
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 ?
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:
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=
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 ?
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