Comments on: Simple platformer game in XNA tutorial – part two “Tile and Board” http://xnafan.net/2013/04/simple-platformer-game-in-xna-tutorial-part-two/ XNA tutorials, code and games Fri, 10 Aug 2018 04:55:21 +0000 hourly 1 https://wordpress.org/?v=4.2.22 By: admin http://xnafan.net/2013/04/simple-platformer-game-in-xna-tutorial-part-two/comment-page-1/#comment-97141 Tue, 04 Feb 2014 15:01:08 +0000 http://xnafan.net/?p=922#comment-97141 Hi Frendy :)

In my code I've made a simple assumption, that if a tile is blocked then it's blocked for everybody, and I draw that tile. If it isn't blocked, it's passable for anybody, and I don't draw the tile.
This is a very simple way of doing this, and from what I can understand, you will need to draw the tile no matter what it is, but then keep track of whether it is passable for A) players and B) enemies as two separate properties.
In that case I suggest you make a Tile class, which in the Draw method just uses its Texture2D for drawing no matter what. Then you could have two boolean properties on the Tile class, e.g. PlayerPassable and EnemyPassable, where you keep track of whether the player or enemies can pass that tile.

Does that help? :)

Kind regards - Jakob

]]>
By: Frendy http://xnafan.net/2013/04/simple-platformer-game-in-xna-tutorial-part-two/comment-page-1/#comment-97095 Tue, 04 Feb 2014 08:17:14 +0000 http://xnafan.net/?p=922#comment-97095 That's not it sir.. Sorry because i am confusing you, what i mean to be invisible is like transparant to the human eye sir. Let's say alpha on the tiles in the game is 1, what i want is set the alpha to be 0, so the human cannot detect any object on the screen, but still known on the AI. The player character can go through the transparant tiles, even though the the alpha is 0. But, the AI character cannot go through the transparant tiles, and for them the transparant tiles is actually the tile that not transparant.

Thank you sir

]]>
By: admin http://xnafan.net/2013/04/simple-platformer-game-in-xna-tutorial-part-two/comment-page-1/#comment-96848 Sun, 02 Feb 2014 06:00:43 +0000 http://xnafan.net/?p=922#comment-96848 Hi Frendy :)

I don't understand what you mean by making the tiles "invisible, but still known to the character in the game, only invisible to the human eye" ?
If you want something to be invisible, just don't draw it in the Draw() method. I will need a bit further clarification on what you want.
Do you mean that the player can only see a few tiles around him, and the rest is in a sort of a "fog of war" ?

Regarding your other request: if you take a look at my "map generation" tutorial
http://xnafan.net/2013/01/2d-map-generation-for-xna/
at the bottom you can find an extended version which has code to save and load maps.
This will let you have different values for different types of tile (e.g. 1 for grass, 2 for dirt, etc.) and then when you build your map, you create the tile objects with the graphics they need to draw themselves (a Texture2D) and information about whether the tile is blocked for character movement (a bool).
The best tile-engine tutorial I've found on the web is this one (by Kurt Jaegers):
http://www.xnaresources.com/default.asp?page=Tutorial:TileEngineSeries:1

Kind regards - Jakob

]]>
By: Frendy http://xnafan.net/2013/04/simple-platformer-game-in-xna-tutorial-part-two/comment-page-1/#comment-96691 Fri, 31 Jan 2014 15:36:18 +0000 http://xnafan.net/?p=922#comment-96691 I mean change the graphics but in the same array, is the example: tile[1,1] is the grass tile, but on the tile [1,2] is the stone tile.

How do u do that sir? Thank you

]]>
By: Frendy http://xnafan.net/2013/04/simple-platformer-game-in-xna-tutorial-part-two/comment-page-1/#comment-96689 Fri, 31 Jan 2014 15:04:58 +0000 http://xnafan.net/?p=922#comment-96689 No, i haven't solve it sir. Do u mind to sent me the sample code regarding to create a map not just randomly setup, but we define it which position of x and y have to be blocked and have to be unblocked.

And if you don't mind, i would like to know how to change the graphics in the tiles, but in the same array. Or how to make the tiles that we just array it and visible to make it invisible, but still known to player in the game, but not visible while user sees it. So, basically invisible tiles, but still known by the character in the game, only invisible to the human eyes.

Example: The enemy is on tile [3,2], and in the [5,2] there is a tile (grass graphic), the enemy move from the [3,2] to [5,2], but the human eyes still see the tile on [5,2] for prevent the enemy to move ahead to [6,2]. What i mean is, the tile on [5,2] is invisible to the human eyes.

Is it possible? And if possible, i would like to know how to do it in XNA.

Thank you very much sir.

Best Regards,

Frendy

]]>
By: admin http://xnafan.net/2013/04/simple-platformer-game-in-xna-tutorial-part-two/comment-page-1/#comment-96646 Fri, 31 Jan 2014 09:55:32 +0000 http://xnafan.net/?p=922#comment-96646 Hi Frendy :)

Yup - that is very much possible.
Did you solve it when looking at the "saving and loading data" tutorial?

Otherwise I can make you a codesample :)

Kind regards - Jakob

]]>
By: Frendy http://xnafan.net/2013/04/simple-platformer-game-in-xna-tutorial-part-two/comment-page-1/#comment-96534 Thu, 30 Jan 2014 06:38:06 +0000 http://xnafan.net/?p=922#comment-96534 Hai, thank you for this great tutorial.. i have been looking for a days how to make a platformer game in XNA.. Really thanks a lot sir ^^

And, if you don't mind,t i have a question regarding the map.. is it possible to make a map constant and not randomly?
So, it is like (example): 0 is for unblocked tiles, and 1 is for blocked tiles. and i have an array like this:

private var Tiles:Array = new Array();

Tiles = [0,0,0,1,1,1,1,1,0,1], <-- this is for row 1
[0,0,0,0,0,0,0,1,1,1] <-- this is for row 2

And that Tiles Array will be for our map, and 0 for unblocked tiles, and 1 for blocked tiles.
Could you please teach us including me how to do it sir? So, basically the map is not random, but we already define it. Thank you

]]>
By: admin http://xnafan.net/2013/04/simple-platformer-game-in-xna-tutorial-part-two/comment-page-1/#comment-79060 Sun, 06 Oct 2013 09:43:58 +0000 http://xnafan.net/?p=922#comment-79060 I've just been reading a couple of articles on Perlin Noise (creating pseudorandom values, which have gradual, natural changes), which is a great way of generating random landscapes. It is used in Minecraft, so you can build a complex world from a single seed.
I will see if I get the time and inspiration in the next couple of months to show how to get from the noisebuilding algorithms to a discoverable world, no promises though 😉
Thanks a lot for your suggestion Lawrence!

]]>
By: Lawrence http://xnafan.net/2013/04/simple-platformer-game-in-xna-tutorial-part-two/comment-page-1/#comment-78999 Sat, 05 Oct 2013 20:47:03 +0000 http://xnafan.net/?p=922#comment-78999 First, thank you for the quick response. Yes games like Terraria and how to do 2D random terrarin generation would be very much appreciated..lol

]]>
By: admin http://xnafan.net/2013/04/simple-platformer-game-in-xna-tutorial-part-two/comment-page-1/#comment-78856 Fri, 04 Oct 2013 20:01:47 +0000 http://xnafan.net/?p=922#comment-78856 Hi Lawrence :)

Glad you like it!
I didn't know what a "2D sandbox" game meant before reading your post and Googling it.
Could you be more specific as to what you would like to see?
The way I understand it, most of the games are like Terraria, Starbound and/or Windforge.
Is that what you're looking for?
In that case, I'm guessing that a lot of the terrain could be generated using the Tile engine technique.
So what else do you need? AI? Random terrain generation? 😀

]]>