<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-625449725945359205</id><updated>2024-10-05T05:30:55.443+02:00</updated><title type='text'>programming java 2d isometric rpg</title><subtitle type='html'>A project where I create a small isometric 2d game in java and try to publish it. The goal is to make money from it and see if there is a market fro a game made by a 1 or 2 person team.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>34</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-662527823109845608</id><published>2013-02-26T14:01:00.002+01:00</published><updated>2013-02-26T14:01:46.588+01:00</updated><title type='text'>I&#39;m back.... sort of.</title><content type='html'>Hey people I&#39;m back again, but not in the sense that I will continue this blog, but I will start one about Unity3d and the stuff I am making there.&lt;br /&gt;
&lt;br /&gt;
After messing around in Unity for a while I decided to create a game for Android devices and since I am a fan of Dungeon Crawlers I started making one. It&#39;s based on the stuff in this blog about random dungeon generation.&lt;br /&gt;
&lt;br /&gt;
The Dungeon Beta is the name and as the name suggests it&#39;s a work in progress that is already available on the android market. Being a beta theres a lot of things changing and you may loose your character from time to time when larger updates gets released.&lt;br /&gt;
&lt;br /&gt;
You can find my new blog here : &lt;a href=&quot;http://gamecreationandprogramminginunity3d.blogspot.dk/&quot; target=&quot;_blank&quot;&gt;Game Creation And Programming In Unity3d&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
It&#39;s new, so only a couple of posts so far.&lt;br /&gt;
&lt;br /&gt;
Best regards&lt;br /&gt;
Rasmus</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/662527823109845608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2013/02/im-back-sort-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/662527823109845608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/662527823109845608'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2013/02/im-back-sort-of.html' title='I&#39;m back.... sort of.'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-2300676941893338105</id><published>2012-03-20T10:24:00.000+01:00</published><updated>2012-03-20T10:24:47.393+01:00</updated><title type='text'>God or bad news</title><content type='html'>I have some good or bad news depending on how you see it.&lt;br /&gt;
&lt;br /&gt;
I have some how convinced my 3d artist friend to create some models for a tower defense game. This means that I will not have time for my own little project, and I will be moving to 3d for that project.&lt;br /&gt;
&lt;br /&gt;
So good news is that I have models to play with, bad news is that this project is shelved for a longer time than first expected.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/2300676941893338105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/03/god-or-bad-news.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/2300676941893338105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/2300676941893338105'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/03/god-or-bad-news.html' title='God or bad news'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-2278159281843719763</id><published>2012-03-06T09:41:00.000+01:00</published><updated>2012-03-06T09:41:41.536+01:00</updated><title type='text'>Spring is here</title><content type='html'>Well almost here anyway, that means that I have a lot of things to do in the garden and around the house, so it will be a bit quite on this blog for a while.&lt;br /&gt;
&lt;br /&gt;
My little project is not scraped, it&#39;s just dormant.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/2278159281843719763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/03/spring-is-here.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/2278159281843719763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/2278159281843719763'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/03/spring-is-here.html' title='Spring is here'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-7577764332085349665</id><published>2012-02-22T20:57:00.002+01:00</published><updated>2012-02-22T21:32:57.402+01:00</updated><title type='text'>More items and player image</title><content type='html'>I added some more items &quot;feet and head&quot;, they have the same item types as the other, iron, steel, dwarven and so on. They can be equipped as well and so can the chest armor now. All I need is pants and shield or other left hand items for a full set of drops. It&#39;s coming along quite nicely and all items that get equipped or unequipped change the players stats. I want to add more items like books &quot;inc xp when read&quot;, postions &quot;permanent inc of str, int&quot; to allow player to gain extra stats from drops.&lt;br /&gt;
&lt;br /&gt;
Why yeesssss, I drew them all my self, how did you know? &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZyLwjGnpYRid8lCxpulc798kqiDtoMVZRhgfxVb_rLfWoOw7wjgqX82WiUUjzVlOxReEVEnPeCbdbmXuqXHZ1euVHK2ZhvsSsj5p72SNYlufhxoZFkcaOOePX-bqKdlMwgq6ty4G6nU8/s1600/Player2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZyLwjGnpYRid8lCxpulc798kqiDtoMVZRhgfxVb_rLfWoOw7wjgqX82WiUUjzVlOxReEVEnPeCbdbmXuqXHZ1euVHK2ZhvsSsj5p72SNYlufhxoZFkcaOOePX-bqKdlMwgq6ty4G6nU8/s320/Player2.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
I added a player image so that I could remove the red square in the center. He get&#39;s colored by the lightmap when the player move around. And yes, he&#39;s not pretty and only point in one direction, but that&#39;s all you get from a free game :-)&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfyez6iHv_DzfvaSKLf3OEJo-HMema1fyIrSay5GMrwG2oanCYTKxPtYvPjPDT1fC5m1eD3olM3e47tPG9GxtjitC9KEwZKrelel7heZfOqyyQvtlRF1QJokhyphenhyphenIECX0vw7lj7MKKL4ZSA/s1600/Player0.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;205&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfyez6iHv_DzfvaSKLf3OEJo-HMema1fyIrSay5GMrwG2oanCYTKxPtYvPjPDT1fC5m1eD3olM3e47tPG9GxtjitC9KEwZKrelel7heZfOqyyQvtlRF1QJokhyphenhyphenIECX0vw7lj7MKKL4ZSA/s320/Player0.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik4iQK6BfsKf6OsXWFFW0N8nCEmal_XOtq6emk88dh6_INsUB5tBGAVYd4-VQ-uAxohuzsN66Ut5bZIceZXnxIDjeiEbYZvL9LbN_LcQGsvDZLi62NTDh5v0GIfYwM4vi6DStc8lF-Olk/s1600/Player1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;211&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEik4iQK6BfsKf6OsXWFFW0N8nCEmal_XOtq6emk88dh6_INsUB5tBGAVYd4-VQ-uAxohuzsN66Ut5bZIceZXnxIDjeiEbYZvL9LbN_LcQGsvDZLi62NTDh5v0GIfYwM4vi6DStc8lF-Olk/s320/Player1.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
So what&#39;s the next step in my development. I think it&#39;s time for some combat. It&#39;s going to be simple, walk up to a monster and then walk into it until you or the monster is dead. Should be fairly simple to implement, all I need now are some cool drawings of monsters........ Hmmm, could just reuse the player image for all monsters. That&#39;s a great idea, or not :-)&lt;br /&gt;
&lt;br /&gt;
And&amp;nbsp; I should probably change the lighting to something more dungeon like instead of the disco lighting I have now. Some torches might be god, with lights of course.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/7577764332085349665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/02/more-items-and-player-image.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/7577764332085349665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/7577764332085349665'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/02/more-items-and-player-image.html' title='More items and player image'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZyLwjGnpYRid8lCxpulc798kqiDtoMVZRhgfxVb_rLfWoOw7wjgqX82WiUUjzVlOxReEVEnPeCbdbmXuqXHZ1euVHK2ZhvsSsj5p72SNYlufhxoZFkcaOOePX-bqKdlMwgq6ty4G6nU8/s72-c/Player2.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-7427995370704087335</id><published>2012-02-21T20:24:00.002+01:00</published><updated>2012-02-21T21:20:44.476+01:00</updated><title type='text'>Equipping weapons and bug hunting</title><content type='html'>Bug hunting, sounds more exiting than it is, and I am not talking about hunting monsters.&lt;br /&gt;
&lt;br /&gt;
I had an annoying bug where chests and bags would not be removed when it was empty. As there are no way to distinguish between a chest that&#39;s empty and one that got items in it, I would need to remove them or the player would have to spend a lot of time checking empty chests for missed loot. It&#39;s fixed now, turned out that I didn&#39;t remove it correctly from the ItemGroupList that&#39;s controlled by the map.&lt;br /&gt;
&lt;br /&gt;
I added the possibility to equip items. At the moment its just the right hand that&#39;s working, but all the basic code for adding item effects to the player like changing armor class, damage, strength and so on is in place. I also added swapping items so that the player don&#39;t have to place the item in the inventory before picking up an equipped item, that also goes for items in the inventory.&lt;br /&gt;
&lt;br /&gt;
So my inventory looks like it did last time I showed it, added some stats in the top part to show effects of using items. &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqNC6iyVCtQTkuwhZ9Zxm3Ym0dEetMdhPgBo0O2-6TSsKlAmO7kulBUYlqUZ8oBddzbv-0zsgk4lw0GNS6W_IWzYpWmEiaZ42cQGFDk3YGIKNXk3z4H1mR2BZn2cV6v_6j4SlHkqRY88s/s1600/inventory1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqNC6iyVCtQTkuwhZ9Zxm3Ym0dEetMdhPgBo0O2-6TSsKlAmO7kulBUYlqUZ8oBddzbv-0zsgk4lw0GNS6W_IWzYpWmEiaZ42cQGFDk3YGIKNXk3z4H1mR2BZn2cV6v_6j4SlHkqRY88s/s320/inventory1.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&amp;nbsp;I drank a potion from the inventory by right clicking it and equipped an iron mace that increased the damage from 1-2 to 2-6, mace doing 1-4 damage and unarmed player doing 1-2.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW3XrSc7cZQkHyf6HUpFvqg_n3JBr2-OqPw-Dp4buiVNxNTJ-h3DZOEM5D__4Wts942Y9plfCFLwWzz5XDzFmIuBqSRarK88x1sGumDWv7WfIQbWzV-opdPc1r-CnyqCPCRN1TdC30rHc/s1600/inventory2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW3XrSc7cZQkHyf6HUpFvqg_n3JBr2-OqPw-Dp4buiVNxNTJ-h3DZOEM5D__4Wts942Y9plfCFLwWzz5XDzFmIuBqSRarK88x1sGumDWv7WfIQbWzV-opdPc1r-CnyqCPCRN1TdC30rHc/s320/inventory2.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Swapped iron mace to a dwarven&amp;nbsp; shortsword and thereby increasing my damage. All seems to work fine, just need to add the other items and create more items that can be randomly generated.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtoJN6HkYn0dURnTRzvKCy9-674n0KA488kZ9uzRrAw9ptXPdOtTqutonDDkZOZ1R_aBKWvLFiirz6FIMuichs7-fA3iSgmiBSmrOfqgf69F0cgbkQmzTICFUgc98W2Xh4OugSuBYoLqo/s1600/inventory3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtoJN6HkYn0dURnTRzvKCy9-674n0KA488kZ9uzRrAw9ptXPdOtTqutonDDkZOZ1R_aBKWvLFiirz6FIMuichs7-fA3iSgmiBSmrOfqgf69F0cgbkQmzTICFUgc98W2Xh4OugSuBYoLqo/s320/inventory3.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Might switch player stats and item stats to float to give more variety, player doing 1.5 damage and item doing 6.6 with monsters having float health as well. Will make item hunting better as you can find more items without drastic increases in damage. Mace 1.0/4.0 dam to 2.0/5.0 dam, it&#39;s a lot of possibilities compared to 1/4 dam to 2/5 dam.&lt;br /&gt;
&lt;br /&gt;
Just noticed that I have 2 slots for the feet, probably going to remove one, and might add slots for rings and necklace. No rpg is complete without magic rings.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/7427995370704087335/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/02/equipping-weapons-and-bug-hunting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/7427995370704087335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/7427995370704087335'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/02/equipping-weapons-and-bug-hunting.html' title='Equipping weapons and bug hunting'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqNC6iyVCtQTkuwhZ9Zxm3Ym0dEetMdhPgBo0O2-6TSsKlAmO7kulBUYlqUZ8oBddzbv-0zsgk4lw0GNS6W_IWzYpWmEiaZ42cQGFDk3YGIKNXk3z4H1mR2BZn2cV6v_6j4SlHkqRY88s/s72-c/inventory1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-1756000814142753335</id><published>2012-02-17T09:18:00.000+01:00</published><updated>2012-02-17T09:18:53.501+01:00</updated><title type='text'>Not switching technologies</title><content type='html'>I have decided not to switch technologies and keep using slick and java to create my game.&lt;br /&gt;
&lt;br /&gt;
I have over the last week experimented with Unity 3D and it&#39;s a fantastic tool for creating 3d games. If you have access to 3d models &quot;an artist&quot; you can in no time create a basic game that you can keep expanding on.&lt;br /&gt;
&lt;br /&gt;
I created a flat box that was the ground, a player controller to move the camera around, some objects that I created in max and added some scripts to objects allowing the player to move them around. It&#39;s just a matter of writing more scripts and adding them to the player or objects to keep evolving the game. Fast and fun.&lt;br /&gt;
&lt;br /&gt;
The reason why I am not using it is that I like programming, and there&#39;s not a lot of that in Unity. Granted, you can write a lot of scripts in java script or c#, but I spend a lot of time manipulating 3d objects in the editor and creating stuff in a 3d modeling program when I would rather be programming.&lt;br /&gt;
&lt;br /&gt;
My pace will slow down a bit from now on as I have a lot of other things on my plate at the moment, but hoping for a bit of time this weekend. Would be nice to add some unholy monsters that are in dire need of some smiting :-)</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/1756000814142753335/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/02/not-switching-technologies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/1756000814142753335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/1756000814142753335'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/02/not-switching-technologies.html' title='Not switching technologies'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-8525002071531572940</id><published>2012-02-13T18:59:00.000+01:00</published><updated>2012-02-13T18:59:16.293+01:00</updated><title type='text'>How to draw isometric tile map</title><content type='html'>Drawing an isometric map is not that different from a regular tile map. Granted there are a bit more going on when calculating where to draw the next tile on the screen, but traversing the map is the same.&lt;br /&gt;
&lt;br /&gt;
On a regular tile map, you start by drawing the tile furthest away so that you don&#39;t overwrite tiles that have already been drawn. It&#39;s the same with isometric. In your head, keep thinking of the map as a 2 dimensional array where you start by drawing all tiles on the x axis and then increasing y and draw all tiles along the x axis on the line. It&#39;s the same thing you do with isometric. There are other ways, but this is the easiest one, at least I think so. The other one involves even and odd lines and stepping through the map in a strange way.&lt;br /&gt;
&lt;br /&gt;
Now you need to draw them on the screen, and that is where the tricky part is. I have added my code to draw the floor, see it below. There are surprisingly..... comments in it, how did that happen?&lt;br /&gt;
&lt;br /&gt;
The code that implements this.&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;private void drawFloor(){&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get player position, only used if player is always at the center of the screen&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; int mapDrawCenterX = player.getMapPositionX();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; int mapDrawCenterY = player.getMapPositionY();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // how many tiles to draw on either side of the player&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; int startMapX = mapDrawCenterX - Globals.DRAW_TILES_X;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; int startMapY = mapDrawCenterY - Globals.DRAW_TILES_Y;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; int endMapX = mapDrawCenterX + Globals.DRAW_TILES_X +1; // +1 is to create a center tile for player&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; int endMapY = mapDrawCenterY + Globals.DRAW_TILES_Y +1; // +1 is to create a center tile for player&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // the first tile to draw&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; int mapX = startMapX;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; int mapY = startMapY;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; // displacing the drawing area so that it&#39;s don&#39;t start at the top left of the screen&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; int drawStartX = 512;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; int drawStartY = -250;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; int drawX = drawStartX;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; int drawY = drawStartY;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; int linesDone = 0;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; boolean done = false;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; while (!done){&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Check if this tile is inside the map, check if the drawing coordinate is inside screen&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if ((map.isInsideMap(mapX, mapY)) &amp;amp;&amp;amp; (drawX &amp;lt;= 1024 || drawY &amp;lt;= 768) &amp;amp;&amp;amp; ((drawX + Globals.FLOOR_TILE_SIZE_X + Globals.FLOOR_TILE_PADDING_X &amp;gt; 0) &amp;amp;&amp;amp; (drawY + Globals.FLOOR_TILE_SIZE_Y + Globals.FLOOR_TILE_PADDING_Y &amp;gt; 0))){&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the tile and check if there is an image to draw. -1 means nothing there.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Tile tile = map.getTile(mapX, mapY);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (tile.getImageIndex(Tile.FLOOR) != -1){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Image floor = map.floorImageList.getImage((tile.getImageIndex(Tile.FLOOR))).getImage();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Get lightmap corners for this tile&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; float[][] lightMapColor = lightMap.getLightCorner(mapX, mapY);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Set image corners to the lightmap corners.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; floor.setColor(0, lightMapColor[0][0], lightMapColor[0][1], lightMapColor[0][2], 1.0f);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; floor.setColor(1, lightMapColor[1][0], lightMapColor[1][1], lightMapColor[1][2], 1.0f);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; floor.setColor(2, lightMapColor[2][0], lightMapColor[2][1], lightMapColor[2][2], 1.0f);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; floor.setColor(3, lightMapColor[3][0], lightMapColor[3][1], lightMapColor[3][2], 1.0f);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Finally draw image&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; floor.draw(drawX, drawY);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // step along the x axis of the map&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; mapX++;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Move drawing &quot;pointer&quot; to the next tile, half tile length on x and half tile height on y&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; drawX += (Globals.FLOOR_TILE_SIZE_X + Globals.FLOOR_TILE_PADDING_X)/2;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; drawY += (Globals.FLOOR_TILE_SIZE_Y + Globals.FLOOR_TILE_PADDING_Y)/2;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Nothing more on this x line on map, starting on next line&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (mapX &amp;gt;= endMapX){&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; linesDone++;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; mapX = startMapX;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; mapY++;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // black magic moving the drawing pointer to the start of the next line ;-)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; drawX = drawStartX - (((Globals.FLOOR_TILE_SIZE_X+Globals.FLOOR_TILE_PADDING_X)/2)*linesDone);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; drawY = drawStartY + (((Globals.FLOOR_TILE_SIZE_Y+Globals.FLOOR_TILE_PADDING_Y)/2)*linesDone);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; //Check if we are done and end the loop&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (mapY &amp;gt;= endMapY)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; done = true;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
There are probably a lot of optimizations that can be done to it, I haven&#39;t looked into it yet as the game was running fast enough as it is. Besides, don&#39;t spend time optimizing stuff before it&#39;s necessary, and use a profiler to identify bottlenecks.&lt;br /&gt;
&lt;br /&gt;
There&#39;s some stuff there you cant see, like the tile padding. I use that as my tiles don&#39;t connect directly, there is a 2 pixels gap between them on the x axis so that the tile below fit&#39;s in it. See pictures below.&lt;br /&gt;
&lt;br /&gt;
The tiles are 62*32 pixels.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_wwCYyBPFMawYAPaHMfAikBaM9Qpz89EBcYujIPEbWMeRysFFZh3LK-17VF6hj0LeoDR5Hm62PF9fieSTp8xgR9FMv0zqvlHLUYtS1Ueid05ksIS8duDskZpWMEIaIBMX21aY8Cr7YOQ/s1600/Tile_description1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_wwCYyBPFMawYAPaHMfAikBaM9Qpz89EBcYujIPEbWMeRysFFZh3LK-17VF6hj0LeoDR5Hm62PF9fieSTp8xgR9FMv0zqvlHLUYtS1Ueid05ksIS8duDskZpWMEIaIBMX21aY8Cr7YOQ/s1600/Tile_description1.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
So when adding more rows of tiles they fit into the 2 pixel gap on the x axis. &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigRFbBqgHoocoG080myJuCpGQar2KsnebjTeKJ0Tgpg8vm1JwOnCruo90CezvOLCvYZ32qIkcryDfmyiCBmaqtaJ6lZejP-ycpBj7Jio5Y_bXNGrSXCJgKPVQSWkj-MV8KaWGn6j_hvUs/s1600/Tile_description2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigRFbBqgHoocoG080myJuCpGQar2KsnebjTeKJ0Tgpg8vm1JwOnCruo90CezvOLCvYZ32qIkcryDfmyiCBmaqtaJ6lZejP-ycpBj7Jio5Y_bXNGrSXCJgKPVQSWkj-MV8KaWGn6j_hvUs/s1600/Tile_description2.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;The 2 pixel gap is not something I came up with, it&#39;s a friend of mine. He&#39;s a graphics artist and it all adds up in the end.&lt;br /&gt;
&lt;br /&gt;
Hope that helped, please ask if you have any more questions.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/8525002071531572940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/02/how-to-draw-isometric-tile-map.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/8525002071531572940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/8525002071531572940'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/02/how-to-draw-isometric-tile-map.html' title='How to draw isometric tile map'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_wwCYyBPFMawYAPaHMfAikBaM9Qpz89EBcYujIPEbWMeRysFFZh3LK-17VF6hj0LeoDR5Hm62PF9fieSTp8xgR9FMv0zqvlHLUYtS1Ueid05ksIS8duDskZpWMEIaIBMX21aY8Cr7YOQ/s72-c/Tile_description1.jpg" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-5524625049894111701</id><published>2012-02-08T09:50:00.000+01:00</published><updated>2012-02-08T09:50:10.505+01:00</updated><title type='text'>Experimenting with a new technology</title><content type='html'>I have over the last couple of days been experimenting with Unity. It&#39;s a 3D game development environment. It&#39;s basically a 3D editor and scripting tool where you can load 3d models or create primitives in Unity, then add script to control those entities.&lt;br /&gt;
&lt;br /&gt;
It am considering moving my project from 2d to 3d. All my game stuff right now is very basic, so a few new textures and it should be working.&lt;br /&gt;
&lt;br /&gt;
I have not tried to generate a lot of random stuff in Unity, so don&#39;t know if my random level stuff would work, but it&#39;s worth a try.&lt;br /&gt;
&lt;br /&gt;
There is a free version of Unity that everybody can download and use. Games developed in this free version is as far as I can see yours to do with as you please. There is of coarse a lot of stuff missing from the free version that you would get in the pro version, like real time shadows, refraction and other stuff that would be cool to have.&lt;br /&gt;
&lt;br /&gt;
One more thing that unity allows for is releasing executables for different platforms, Windows, Mac, Iphone and android. You can also create a web launcher so that you game can be run from a web page, now that would be great for my project so that it can be played directly from the site I choose to release it from.&lt;br /&gt;
&lt;br /&gt;
One downside is that I have to learn a 3d program of some sort. Hmmmm, not my strong side but might be a great learning experience and being self proficient might be a good thing.&lt;br /&gt;
&lt;br /&gt;
More experimenting will follow. If it proves suitable for my project I will switch to Unity.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/5524625049894111701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/02/experimenting-with-new-technology.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/5524625049894111701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/5524625049894111701'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/02/experimenting-with-new-technology.html' title='Experimenting with a new technology'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-2305475921154071996</id><published>2012-01-30T20:51:00.000+01:00</published><updated>2012-01-30T20:51:45.832+01:00</updated><title type='text'>One level wonder game design</title><content type='html'>I have been busy that last couple of days doing other stuff than programming. I upgraded my graphics card to an Nvidia GTX 580. For some reason, every time I upgrade my computer i seem to loos all my spare time ;-) I did manage to play Skyrim, Rage and Serious Sam 3. Rage is so close to perfect that it&#39;s unbelievable. Once you get the shotgun, you can almost feel the kick.&lt;br /&gt;
&lt;br /&gt;
Well back to programming games :-)&lt;br /&gt;
&lt;br /&gt;
I have been thinking about how I want my game to proceed. There are basically 2 ways it can work. First is that the player start out on level one, finds a set of stairs down and start all over again. If the player reaches a level that is too tough, he can walk up the stairs and retry the last level. Or it&#39;s a one level game, meaning, every time the player completes a level, he is returned to a score / menu where he can choose to play another level. Every time he completes one, he is rewarded with something extra.&lt;br /&gt;
&lt;br /&gt;
I am sort of leaning towards the last one where one level is played, when the &quot;quest&quot; is solved, he is returned and rewarded. This simplifies things allot and also opens up for shops, skill assignment, character leveling up and other in between killing monsters stuff.&lt;br /&gt;
&lt;br /&gt;
I have also been trying out Unity 3D and think that once I have completed this game, I should try to create something in that. It&#39;s a great way to enter 3d game programming as the engine and editor is already there, all you need is a programmer and an artist to start creating something, and the free version is fairly good. Missing a few things that would be nice to have like some lighting stuff, but all in all fairly good.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/2305475921154071996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/one-level-wonder-game-design.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/2305475921154071996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/2305475921154071996'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/one-level-wonder-game-design.html' title='One level wonder game design'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-931417621030235913</id><published>2012-01-22T18:06:00.000+01:00</published><updated>2012-01-22T18:06:46.352+01:00</updated><title type='text'>More inventory and item description</title><content type='html'>Did a bit more inventory programming to resolve some of the bugs and minor issues.&lt;br /&gt;
&lt;br /&gt;
First thing was that I had to figure out how to create a lot of random items with different stats without creating a weapons class, potion class, and so on. What I did was to just create a basic item class that had all the information that all items must have. I the added a HashMap where I add all the stats that this item will affect and by how much. I then just run through that map and add or subtract from the player stats when an item is used.&lt;br /&gt;
&lt;br /&gt;
I added item description, so when you move the mouse over an item, it shows name and the stats it will modify. This might have to be changed in the future if items start having a lot of stats as they just get rendered next to the mouse cursor.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgavelI9bkVgPdp3S6-ow9DVO-Jz0h27zjuNtvOeEMzCJSI850H_uGokxGPk9YE5VRazXipdNVZ5aOpxo34aEJ79UspsZaFwTYIwDkUSO51jH_4gwL97mNp50IxqpoqxBCl9S5XY-JfrSU/s1600/dungeon_inventory4.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgavelI9bkVgPdp3S6-ow9DVO-Jz0h27zjuNtvOeEMzCJSI850H_uGokxGPk9YE5VRazXipdNVZ5aOpxo34aEJ79UspsZaFwTYIwDkUSO51jH_4gwL97mNp50IxqpoqxBCl9S5XY-JfrSU/s320/dungeon_inventory4.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Also prevented ground items from exceeding the 8 boxes. Still have to add a way to scroll through them or some other way. Could be to just push the remaining items to a tile next to this one. It&#39;s the Diablo 2 way. You could not have more than one item on a tile.&lt;br /&gt;
&lt;br /&gt;
Anyhow, I only need to equip items and the inventory is done.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/931417621030235913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/more-inventory-and-item-description.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/931417621030235913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/931417621030235913'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/more-inventory-and-item-description.html' title='More inventory and item description'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgavelI9bkVgPdp3S6-ow9DVO-Jz0h27zjuNtvOeEMzCJSI850H_uGokxGPk9YE5VRazXipdNVZ5aOpxo34aEJ79UspsZaFwTYIwDkUSO51jH_4gwL97mNp50IxqpoqxBCl9S5XY-JfrSU/s72-c/dungeon_inventory4.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-222034387507312623</id><published>2012-01-22T00:23:00.000+01:00</published><updated>2012-01-22T00:23:11.768+01:00</updated><title type='text'>Inventory and item generation</title><content type='html'>So inventory is almost done. I had to draw a few more item images to actually be able to tell the difference between items as I don&#39;t have any item descriptions popping op when mouse hovers over an item.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaJ6VeHYVR9AFaSNzFAHFOFJ6EKRJpHEmoKvQKGxwqnaip5g3gqwxRqiwhU3dneOjLQ1dq-XS-8lJlLpve-UQ4mKDN-YNtyIqMAG4S6VN9yr7jkYCPHtJkfKsX8fzbgJesKTIjGrCP-uk/s1600/dungeon_inventory1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaJ6VeHYVR9AFaSNzFAHFOFJ6EKRJpHEmoKvQKGxwqnaip5g3gqwxRqiwhU3dneOjLQ1dq-XS-8lJlLpve-UQ4mKDN-YNtyIqMAG4S6VN9yr7jkYCPHtJkfKsX8fzbgJesKTIjGrCP-uk/s320/dungeon_inventory1.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
There is room for 8 items on the ground. If there are more than 8 items they will just render outside the ground area and onto the character part. That needs fixing. Items can be added to the inventory by clicking them. At the moment they just get added to the first free slot. I will change that to allow the player to place them where he wants.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivwvuz-mFGnrzK2K7BfZuHuUr-kPMPJkYCfjqgAdodS7ZMh3mEXORK8TN7Pvn-Ks7aOdWv04dByT-Prcd7vY7SHGK_pGGdpQGNpLeKNL_1D_e4kkKekdd0YVWbFRDSGZCtFdNoMFheqJs/s1600/dungeon_inventory2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivwvuz-mFGnrzK2K7BfZuHuUr-kPMPJkYCfjqgAdodS7ZMh3mEXORK8TN7Pvn-Ks7aOdWv04dByT-Prcd7vY7SHGK_pGGdpQGNpLeKNL_1D_e4kkKekdd0YVWbFRDSGZCtFdNoMFheqJs/s320/dungeon_inventory2.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Potions can be used from the inventory but items can&#39;t be equipped yet. All items when in the inventory can be moved around by clicking an item, it&#39;s then displayed under the mouse cursor and you can place it again by left clicking. If you right click, the item is returned to it&#39;s previous location. You can also drop it on the ground by clicking one of the looting boxes in the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFt3x0uDbrS5ozfDR-8IZqEfzJVoAgpaVoBJ2QHnnR81KrduCsYiUlLY2mcf4RPpFGLDcXI_vEZWQbfoD18N9TVErG-bgdIgpJ_m8DddJ9uUaZoi2admzoIuQ05emWC-jx9fXrh_Rqcu4/s1600/dungeon_inventory3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFt3x0uDbrS5ozfDR-8IZqEfzJVoAgpaVoBJ2QHnnR81KrduCsYiUlLY2mcf4RPpFGLDcXI_vEZWQbfoD18N9TVErG-bgdIgpJ_m8DddJ9uUaZoi2admzoIuQ05emWC-jx9fXrh_Rqcu4/s320/dungeon_inventory3.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
There&#39;s a lot of fiddling around before it&#39;s done.&lt;br /&gt;
&lt;br /&gt;
I have started on an item generator so that I don&#39;t have to create a lot of content. It can generate items of 4 different levels. A short sword can have an Iron, Steel, Dwarf or Elven blade. There&#39;s only 2 weapons, short sword and mace, one chest armor and a healing potion that gets generated at the moment. But it&#39;s fairly easy to add more.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/222034387507312623/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/inventory-and-item-generation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/222034387507312623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/222034387507312623'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/inventory-and-item-generation.html' title='Inventory and item generation'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaJ6VeHYVR9AFaSNzFAHFOFJ6EKRJpHEmoKvQKGxwqnaip5g3gqwxRqiwhU3dneOjLQ1dq-XS-8lJlLpve-UQ4mKDN-YNtyIqMAG4S6VN9yr7jkYCPHtJkfKsX8fzbgJesKTIjGrCP-uk/s72-c/dungeon_inventory1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-7676222455971381967</id><published>2012-01-19T21:42:00.000+01:00</published><updated>2012-01-19T21:42:42.091+01:00</updated><title type='text'>Looting and inventory</title><content type='html'>Could not escape it any longer, so grabbed my favorite free drawing program and started creating an inventory with space for a looting section. I decided to combine the two things as they are fairly similar. With my limited drawing skills and this being a first draft I drew this&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_qLoMW437orzc09UTZtCxsqmeWdZ_ZW9Bzlafn2eKbOObjxm45hkmVfQ-GERAWxvsSe7ePhEnpe7AdTIqDecLVisO1jJd0KT8hI8LeYyMAR012Bqur0C78RUxSJeXTzK_Dum6pd2E8hE/s1600/dungeon_looting0.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_qLoMW437orzc09UTZtCxsqmeWdZ_ZW9Bzlafn2eKbOObjxm45hkmVfQ-GERAWxvsSe7ePhEnpe7AdTIqDecLVisO1jJd0KT8hI8LeYyMAR012Bqur0C78RUxSJeXTzK_Dum6pd2E8hE/s320/dungeon_looting0.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;I am particularly proud of the man underneath the equipped boxes, to bad you cant see him smiling, so here&#39;s he&#39;s face :-)&lt;br /&gt;
&lt;br /&gt;
The plan is that the bottom row of boxes are for items on the ground that can be picked up. When clicked they will be moved to the first free box in the inventory. If there are more items than what can be shown, a small arrow should be shown to scroll through them. I have actually implemented this, sort of anyway. Well not the scrolling arrow thing, but the picking up item stuff. Took a few shortcuts and when the mouse is clicked it just moves the first item from ground to the first free inventory slot.&lt;br /&gt;
&lt;br /&gt;
I only have one item at the moment, lacking more images and an item generator I only created a healing potion. It looks like this&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn-Meq5w96KL_wtMptEeEQ6tax9xIavKFNTtiwhyJlGHj0M4kSJP0y9rFtJ0IkrUB9fTTrcvOxSuERkUn_GxBraKJyX5ihfHaZfOZyS1yBAoJhmY97H6hxuLL1BQZjvIoIo5A6XDUKsjc/s1600/dungeon_looting1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn-Meq5w96KL_wtMptEeEQ6tax9xIavKFNTtiwhyJlGHj0M4kSJP0y9rFtJ0IkrUB9fTTrcvOxSuERkUn_GxBraKJyX5ihfHaZfOZyS1yBAoJhmY97H6hxuLL1BQZjvIoIo5A6XDUKsjc/s320/dungeon_looting1.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
And after clicking the mouse it&#39;s moved to the inventory and it looks remarkably similar.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhngE4bMDYrxo6glGMLiSEAYyDxmfvfoOpCgf9mk-gqlKTS72ng3cyAcW-hs9DeqWoL_x5BZ21jD0IQMqiclrnBTNzHEbFVDRsjcEYE5mvvnjQQ59W0LX8xhKttkoUJauDu9Q7Dpf6kjR4/s1600/dungeon_looting2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhngE4bMDYrxo6glGMLiSEAYyDxmfvfoOpCgf9mk-gqlKTS72ng3cyAcW-hs9DeqWoL_x5BZ21jD0IQMqiclrnBTNzHEbFVDRsjcEYE5mvvnjQQ59W0LX8xhKttkoUJauDu9Q7Dpf6kjR4/s320/dungeon_looting2.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
So what&#39;s missing. A proper way to loot items and a way to move them around in the bag. A way to equip them or use them from inventory. And a lot of code clean up. As I had no idea what I wanted, and took a few shortcuts to get something working there&#39;s a few problems that need eliminating.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/7676222455971381967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/looting-and-inventory.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/7676222455971381967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/7676222455971381967'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/looting-and-inventory.html' title='Looting and inventory'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_qLoMW437orzc09UTZtCxsqmeWdZ_ZW9Bzlafn2eKbOObjxm45hkmVfQ-GERAWxvsSe7ePhEnpe7AdTIqDecLVisO1jJd0KT8hI8LeYyMAR012Bqur0C78RUxSJeXTzK_Dum6pd2E8hE/s72-c/dungeon_looting0.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-2303387076069378614</id><published>2012-01-18T21:47:00.001+01:00</published><updated>2012-01-18T21:50:40.170+01:00</updated><title type='text'>Overlay</title><content type='html'>I didn&#39;t feel like programming items, well to be honest, I am a bit stuck on the looting system. Not really sure how I want it to work. So I added something else that I had planed on doing later as it wont add anything game wise, but looks good. Well it would if I could draw.&lt;br /&gt;
&lt;br /&gt;
I added overlays to floor and both walls. It&#39;s a small image that get&#39;s drawn over the floor or walls to add variety. It creates a sens of the walls being different without actually having different walls.&lt;br /&gt;
&lt;br /&gt;
It didn&#39;t reduce the fps as much as I had thought it would. I only have 1 image for the walls, a drain pipe kind of thing and 1 for the floor a scratch. It&#39;s easy to ad more, just draw, add and set how much it needs displacing when drawn.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibMMz13qqVt8WGeGuHOW6CGKPO6vSliReXA4YCSSjYTXuSkK85LuelaktJX50phtS-3D-Yb9fVt_jF-XVjs-hJleKBRVaRG2ko2mUe4R4j1yv29o_jltSowF3i2Hvqcv8t3Q3T7Nncq_g/s1600/dungeon_overlay.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibMMz13qqVt8WGeGuHOW6CGKPO6vSliReXA4YCSSjYTXuSkK85LuelaktJX50phtS-3D-Yb9fVt_jF-XVjs-hJleKBRVaRG2ko2mUe4R4j1yv29o_jltSowF3i2Hvqcv8t3Q3T7Nncq_g/s320/dungeon_overlay.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;I know there are to many drain pipes, some of them will get replaced with other images as they get added.&lt;br /&gt;
&lt;br /&gt;
I was thinking of combining wall and floor overlays, so that if there is a certain kind of overlay on the wall, it automatically draws a matching overlay on the floor. Like the drain pipe and then a puddle of water on the floor. A crack in the wall and some loos bricks on the floor. Stuff like that.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/2303387076069378614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/overlay.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/2303387076069378614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/2303387076069378614'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/overlay.html' title='Overlay'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibMMz13qqVt8WGeGuHOW6CGKPO6vSliReXA4YCSSjYTXuSkK85LuelaktJX50phtS-3D-Yb9fVt_jF-XVjs-hJleKBRVaRG2ko2mUe4R4j1yv29o_jltSowF3i2Hvqcv8t3Q3T7Nncq_g/s72-c/dungeon_overlay.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-1091567023732602227</id><published>2012-01-16T21:31:00.000+01:00</published><updated>2012-01-16T21:31:01.664+01:00</updated><title type='text'>Lootable items on map and placeholders</title><content type='html'>I will be drawing placeholders for items as I do not want to spend 2 - 3 hours drawing something like a chest. I would rather spend the time programming. So my first place holder is a chest, it&#39;s not pretty, but with a bit of imagination, you can see that it is.&lt;br /&gt;
&lt;br /&gt;
I have added a hash map to my map class that contain MapItemGroup where the key is an integer that is calculated based on x and y coordinate (y * MAX_MAP_X) + x. All items on them map is pooled in a chest if generated by the map or a bag if dropped from monsters.&lt;br /&gt;
&lt;br /&gt;
I have expanded my move command to check the map for item groups and change the image from chest_closed to chest_open if it&#39;s a chest and the same for bag&#39;s.&lt;br /&gt;
&lt;br /&gt;
Chests also have light on them, to make them look like they are part of the game and not just a sprite drawn on top of every thing else. I just add the color values of r, g, b and divide by 4 to average them and use that as a single color for the chest.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVOJzMm-wJZ1KS7QnHV7Jtm-gZgC1yPL4yNyF7tnPzXv6vZPGpD0QM7uVdSmz-tozDJpA42jyDetn3mugVjStiEzLsqWWnBK44BQh9ocMwcMm_3fCDf-4gkeXyXd-06CxD40y7lXu4Rhk/s1600/dungeon_chest1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVOJzMm-wJZ1KS7QnHV7Jtm-gZgC1yPL4yNyF7tnPzXv6vZPGpD0QM7uVdSmz-tozDJpA42jyDetn3mugVjStiEzLsqWWnBK44BQh9ocMwcMm_3fCDf-4gkeXyXd-06CxD40y7lXu4Rhk/s320/dungeon_chest1.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigMdfbaXKUupOQACzgWcexUDWyeLHZpwpuyqTKre2k-uVgvQtusI4O1vWwDJuxLmjcvQIwcA06TXo9OQ6zTS5LCP02bcT0NWmxUkT0cgfxuDwG6Uc8p-nVbAI8sHB5mYbj53Dd0HXR8D0/s1600/dungeon_chest2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigMdfbaXKUupOQACzgWcexUDWyeLHZpwpuyqTKre2k-uVgvQtusI4O1vWwDJuxLmjcvQIwcA06TXo9OQ6zTS5LCP02bcT0NWmxUkT0cgfxuDwG6Uc8p-nVbAI8sHB5mYbj53Dd0HXR8D0/s320/dungeon_chest2.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
There&#39;s still no items in them, that&#39;s the next thing.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/1091567023732602227/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/lootable-items-on-map-and-placeholders.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/1091567023732602227'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/1091567023732602227'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/lootable-items-on-map-and-placeholders.html' title='Lootable items on map and placeholders'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVOJzMm-wJZ1KS7QnHV7Jtm-gZgC1yPL4yNyF7tnPzXv6vZPGpD0QM7uVdSmz-tozDJpA42jyDetn3mugVjStiEzLsqWWnBK44BQh9ocMwcMm_3fCDf-4gkeXyXd-06CxD40y7lXu4Rhk/s72-c/dungeon_chest1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-1265456743055614321</id><published>2012-01-16T19:10:00.001+01:00</published><updated>2012-01-16T19:14:02.207+01:00</updated><title type='text'>Fixing missing and broken things.</title><content type='html'>Got the refactoring done and it reduced the program size a bit and it&#39;s now easier to create new graphics without having to add them to a big tile sheet, The problem was that when adding a stone wall as wall1, then you either had to create a stone wall for wall2 or leave it blank to get the map image index to work right. index 1 on the map was image 1 for wall1, wall2, floor, wall top. If I only wanted a specific wall as wall1... You see the problem, or not. Anyway it&#39;s working fine now.&lt;br /&gt;
&lt;br /&gt;
Second thing I fixed was the light blending on the walls. It was not smooth. It was an eyesore now that I finally got the blending on the floor to look right. And here is what it looks like now.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxbi8CD9fxw5PPKeQFrphWKjN6rdVxLWnDiXoo8JWnZrgmY1wlAKiqlSR0Ec54ruxqZL2_Ot74UubkpioA9L6Pr2KIda4sNRleSRqCIH3nFojt5-7-Qabc8e2egX3Oe483wK5XN_KERZ8/s1600/dungeon_light_blend_walls.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxbi8CD9fxw5PPKeQFrphWKjN6rdVxLWnDiXoo8JWnZrgmY1wlAKiqlSR0Ec54ruxqZL2_Ot74UubkpioA9L6Pr2KIda4sNRleSRqCIH3nFojt5-7-Qabc8e2egX3Oe483wK5XN_KERZ8/s320/dungeon_light_blend_walls.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Pretty good if I must say so, and I must.&lt;br /&gt;
&lt;br /&gt;
Now back to adding items, inventory and lootable things.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/1265456743055614321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/fixing-missing-and-broken-things.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/1265456743055614321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/1265456743055614321'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/fixing-missing-and-broken-things.html' title='Fixing missing and broken things.'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxbi8CD9fxw5PPKeQFrphWKjN6rdVxLWnDiXoo8JWnZrgmY1wlAKiqlSR0Ec54ruxqZL2_Ot74UubkpioA9L6Pr2KIda4sNRleSRqCIH3nFojt5-7-Qabc8e2egX3Oe483wK5XN_KERZ8/s72-c/dungeon_light_blend_walls.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-6655316026762706939</id><published>2012-01-16T09:16:00.000+01:00</published><updated>2012-01-16T09:16:38.475+01:00</updated><title type='text'>Refactoring images and rendering</title><content type='html'>So I had a bit of time this Sunday and was messing with the images that I use to render the scene. I had created sprite sheets to store all the images in, but it was getting increasingly annoying to add new tiles to the sheets. So I decided to split them up in single images. As I don&#39;t expect to have to many images in my little game it should not be a problem.&lt;br /&gt;
&lt;br /&gt;
Refactoring a very important and deeply rooted function of a game is quite a big task. But well worth the effort when it&#39;s done. Might be a good time to separate the slick images from the game so that I can replace slick later if it proves not to live up to my expectations.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/6655316026762706939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/refactoring-images-and-rendering.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/6655316026762706939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/6655316026762706939'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/refactoring-images-and-rendering.html' title='Refactoring images and rendering'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-8972948190834651509</id><published>2012-01-07T10:22:00.000+01:00</published><updated>2012-01-07T10:22:21.380+01:00</updated><title type='text'>Items and inventory</title><content type='html'>Started developing inventory and items. My plan is to have a list that contain item groups on the map, so if a monster drops 2 items on the same tile, they will appear in a bag on the map. When the player clicks the bag, a list of items shows up that can be looted.&lt;br /&gt;
&lt;br /&gt;
This will also work well for chests and other objects that is generated and placed on the map. All I have to do is change the image that is draw from a bag to a chest and it&#39;s done.&lt;br /&gt;
&lt;br /&gt;
I want to generate random items, from drops and chests. I will probably create something that looks like Diablo 2 item&#39;s. They will have a name, prefix, suffix and random stats. Example could be flaming short sword of might that would look like this :&lt;br /&gt;
&lt;br /&gt;
Damage 2 - 6&lt;br /&gt;
Fire damage +3&lt;br /&gt;
Strength + 1&lt;br /&gt;
&lt;br /&gt;
Flaming covers 1 - 5 fire damage, burning covers 6 - 10 fire damage and so on. There should be some limitations on what effects can be mixed, fire and ice is a no no. Flaming sword of freezing, fun but no.&lt;br /&gt;
&lt;br /&gt;
That way a random item is pretty easy to create. I might also add the possibility to create something that&#39;s permanent, like a strength or health boost potion.&lt;br /&gt;
&lt;br /&gt;
At the moment my items are very simple, only a name and an item level. Just working on getting the map, render and item group list to work as intended.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/8972948190834651509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/items-and-inventory.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/8972948190834651509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/8972948190834651509'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/items-and-inventory.html' title='Items and inventory'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-4992823150001269243</id><published>2012-01-06T16:44:00.002+01:00</published><updated>2012-01-06T16:44:59.178+01:00</updated><title type='text'>New image of light</title><content type='html'>I was testing some stuff when this map was generated, looks pretty good, so wanted to share.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQqPpou4JOEq8C47kKxhyYzpyPKzpOqFRdT3I4-DsLptbSxw7kffVgUtYelNfFgFbRlto6udATuwFa72X2b3iJYh3jPQfRaQWRTsjm5ijQHS__nJdqO8lAzMrQYdM0FAEioTP6HQCVibc/s1600/light08.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQqPpou4JOEq8C47kKxhyYzpyPKzpOqFRdT3I4-DsLptbSxw7kffVgUtYelNfFgFbRlto6udATuwFa72X2b3iJYh3jPQfRaQWRTsjm5ijQHS__nJdqO8lAzMrQYdM0FAEioTP6HQCVibc/s320/light08.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/4992823150001269243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/new-image-of-light.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/4992823150001269243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/4992823150001269243'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/new-image-of-light.html' title='New image of light'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQqPpou4JOEq8C47kKxhyYzpyPKzpOqFRdT3I4-DsLptbSxw7kffVgUtYelNfFgFbRlto6udATuwFa72X2b3iJYh3jPQfRaQWRTsjm5ijQHS__nJdqO8lAzMrQYdM0FAEioTP6HQCVibc/s72-c/light08.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-8462351206088753207</id><published>2012-01-05T19:14:00.006+01:00</published><updated>2012-01-05T21:37:25.546+01:00</updated><title type='text'>More light part 2</title><content type='html'>Okay, so averaging the corners from the tiles surrounding one til, did not work at all. I am not even going to post pictures of it. What I will post pictures of is another method that I used to get it to look very close to what I want.&lt;br /&gt;
&lt;br /&gt;
A very simple step by step description of what I do from start to end.&lt;br /&gt;
&lt;br /&gt;
1. Use&amp;nbsp; Bresenham&#39;s line algorithm to calculate what tiles have light on them and calculate the light strength based on distance from the light. All tiles are lit the same, so all corners are set to the same value.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJxuMBwokAZrQVag19niAK8_xYn4V59YfoIefPQMMS7A_83KK5CHY-vWWHxonaz9knJHYCqzuU4MGI7yCtwCkbjvpJrQmRM7Pi5PMbLsPPBJSWC8Y0bezCeME4QkhSfTIx1fL74uQE9Rc/s1600/light01.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJxuMBwokAZrQVag19niAK8_xYn4V59YfoIefPQMMS7A_83KK5CHY-vWWHxonaz9knJHYCqzuU4MGI7yCtwCkbjvpJrQmRM7Pi5PMbLsPPBJSWC8Y0bezCeME4QkhSfTIx1fL74uQE9Rc/s320/light01.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
2. Then spread the light from lit tiles to unlit tiles by adding all the light from surrounding tiles and dividing by the number of tiles then adding that value to the unlit tile.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYnET-RbNLJvmT_Drw4Bf5EYK7lK4MLDDgibwOG6MfVRIwDktwMLLksUN5XBcoGI9VXvrL6hto7bx3ogZvkZff_51iibMSsh8BKJ-3usciOzONlMlj-NEuo-mIJZC0bsn44nRypdLprrs/s1600/light02.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYnET-RbNLJvmT_Drw4Bf5EYK7lK4MLDDgibwOG6MfVRIwDktwMLLksUN5XBcoGI9VXvrL6hto7bx3ogZvkZff_51iibMSsh8BKJ-3usciOzONlMlj-NEuo-mIJZC0bsn44nRypdLprrs/s320/light02.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
3. I do step 2 again to spread it even more.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu_Iosuc7YID_sabAuvw-7geq4T8s1yBeWP9_rPihyphenhyphenUyPIfPtT5kdvXj7Rpclut1G2dzjZ-lIKmddfXv2UAecIHwqFL7ovEG5laeqeQUotGRc7W1fE-7k19vB6o-fsNSE8QfQ1phPYX44/s1600/light03.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu_Iosuc7YID_sabAuvw-7geq4T8s1yBeWP9_rPihyphenhyphenUyPIfPtT5kdvXj7Rpclut1G2dzjZ-lIKmddfXv2UAecIHwqFL7ovEG5laeqeQUotGRc7W1fE-7k19vB6o-fsNSE8QfQ1phPYX44/s320/light03.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
4. I calculate the color a corner should have based on the  tile that it&#39;s overlapping. For exampled corner 0 overlaps the tile that  is one to the left of this one, so -1 on x axis. I add the colors of  corner 3 and 2 and divide by 2, then add the color of corner 1 and 2 and  divide by 2 from the tile to the left. Those 2 numbers then gets added to the original color of  corner 0 and divided by 3. I do the same for the rest of the corners.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWxJZhn0z8z2Pg4mT671lz30lENdVf8yS5qNXr-yIe4x1g_l16ppYy9neZtlgez-IBdv6N05RkrTUQ5Td7L3-_jeJgAY7B9WlqXsE08MH_9UPWqMBknwbv39rAvMmiYGtQafVRayioR_M/s1600/light04.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWxJZhn0z8z2Pg4mT671lz30lENdVf8yS5qNXr-yIe4x1g_l16ppYy9neZtlgez-IBdv6N05RkrTUQ5Td7L3-_jeJgAY7B9WlqXsE08MH_9UPWqMBknwbv39rAvMmiYGtQafVRayioR_M/s320/light04.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
5. I repeat step 4 one more time to even out the light a bit more.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhq04aKGpPnN-tKkQJDHXUg-rY7QNvdgxk9guLbdGXLPNwB7P7xsrU70UmixU44vbQBCMHXdo4QvKJEq8de6-CdGcAhdXPVvigB7wSbzXCqre8laTTXoCSTUjTEU519WfT7eDRHDkDT8h8/s1600/light05.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhq04aKGpPnN-tKkQJDHXUg-rY7QNvdgxk9guLbdGXLPNwB7P7xsrU70UmixU44vbQBCMHXdo4QvKJEq8de6-CdGcAhdXPVvigB7wSbzXCqre8laTTXoCSTUjTEU519WfT7eDRHDkDT8h8/s320/light05.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. I then add ambient light to all tiles that have a rgb value that is less then what i have chosen for my ambient light value.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjo5dGRRipL0K9FCCzxU59LMjJTwqa-YamXudkI6QMdcCnBQpzLczz0V6NSG-jXel4Wh7MH4I64BLagV-7CvtxShGJCqZ-rCt8rOw5Bria_C0BELkT7mmAJ4Gn5GFO4-iu7Y1wvZJQJT8U/s1600/light06.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjo5dGRRipL0K9FCCzxU59LMjJTwqa-YamXudkI6QMdcCnBQpzLczz0V6NSG-jXel4Wh7MH4I64BLagV-7CvtxShGJCqZ-rCt8rOw5Bria_C0BELkT7mmAJ4Gn5GFO4-iu7Y1wvZJQJT8U/s320/light06.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
I have tested the color blending as well and with 250 random lights on my map it looks like this.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn8Y0YwDEo7XwG1xD3P-e3ovvFAzXPwTBeVicI2G5JAQZ2KCbx2QUPaXeT4vUX0l16DGHwe03C_mE94nSDyKekcKU2hhIB43Y5jbnPG7nrl5pEWi-YlB9o-gmsgg6dRYmJq80Ojc3UxRU/s1600/light07.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn8Y0YwDEo7XwG1xD3P-e3ovvFAzXPwTBeVicI2G5JAQZ2KCbx2QUPaXeT4vUX0l16DGHwe03C_mE94nSDyKekcKU2hhIB43Y5jbnPG7nrl5pEWi-YlB9o-gmsgg6dRYmJq80Ojc3UxRU/s320/light07.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
There&#39;s still a few problems with walls that do not look like I want them, but it should be fixable.&lt;br /&gt;
&lt;br /&gt;
If you would like to see some code, let me know and I will try to clean it up a bit and post some of it.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/8462351206088753207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/more-light-part-2.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/8462351206088753207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/8462351206088753207'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/more-light-part-2.html' title='More light part 2'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJxuMBwokAZrQVag19niAK8_xYn4V59YfoIefPQMMS7A_83KK5CHY-vWWHxonaz9knJHYCqzuU4MGI7yCtwCkbjvpJrQmRM7Pi5PMbLsPPBJSWC8Y0bezCeME4QkhSfTIx1fL74uQE9Rc/s72-c/light01.jpg" height="72" width="72"/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-31984916492899458</id><published>2012-01-04T08:05:00.000+01:00</published><updated>2012-01-04T08:05:15.172+01:00</updated><title type='text'>More light</title><content type='html'>For some strange reason, I can&#39;t stop fiddling with the lights. My plan was to move on to inventory and items to get some game content going, but every time I test something, I keep getting annoyed because the lights don&#39;t look exactly like I want them to.&lt;br /&gt;
&lt;br /&gt;
So I am back for more light.&lt;br /&gt;
&lt;br /&gt;
The plan is to rewrite the light map and try to get the light to fade from one tile to the next. This is a challenge as my images are squares with i diamond in them. That mean that they overlap each other. So it&#39;s not enough to get the corners of the images the same light %, but it has to be a calculation of light on the tiles around them.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have several ideas on how to do this, the first one I will try is to just add up all the corners that overlap and divide by number of corners. This can also reduce my light map size as I only need one color for 1 corner of 4 tiles. I am not sure this will have the desired effect, but at the moment in my head it sounds okay. At least enough to try it out.&lt;br /&gt;
&lt;br /&gt;
Will post pictures of success....... or failure if that is the case when I try it out.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/31984916492899458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/more-light.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/31984916492899458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/31984916492899458'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/more-light.html' title='More light'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-4495309539792917678</id><published>2012-01-02T11:12:00.000+01:00</published><updated>2012-01-02T18:00:15.276+01:00</updated><title type='text'>Scripting</title><content type='html'>Scripting or not, I choose not to script.&lt;br /&gt;
&lt;br /&gt;
The reason why is that scripting is overkill/unnecessary when only 1 or 2 people work on a project. Scripting is for a larger team of people where you need to work on multiple parts of the game at the same time. You can create almost the entire game in scripts if you want to, but it&#39;s more efficient to do it in you preferred programming language.&lt;br /&gt;
&lt;br /&gt;
Scripting is fantastic if you have a stable version of your game, and a bunch of people that need to create for example AI. While the programmers work on graphic stuff the scripting people can create AI without recompiling the entire code base. They just need to reload some scripts and off they go. It&#39;s an efficient way to have many people working on different parts of a game at the same time.&lt;br /&gt;
&lt;br /&gt;
I am just me and myself, and we don&#39;t work at the same time, so not a problem.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/4495309539792917678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/scripting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/4495309539792917678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/4495309539792917678'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2012/01/scripting.html' title='Scripting'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-5437947944344920207</id><published>2011-12-28T18:17:00.000+01:00</published><updated>2011-12-28T18:17:26.266+01:00</updated><title type='text'>Lighting, light map and post processing</title><content type='html'>Amazingly I got something done today even tho all the kids are here, all 5 of them.&lt;br /&gt;
&lt;br /&gt;
I got the lights to blend better and smoothed them out a bit. The image is with a 150 random lights. It takes about a second to calculate everything, so no waiting.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLEbOS8xVkh2T7lCHlWSrawkxjE1tZIHJTTlItiTbE_RZPM3Smc381B1czp_uCgP901vI7zKutowoVBNTQuMyTv4nx6ShnVk3DJwCEWisBrQ1ZtQRan9VHGbYMWFBQD1PuRMcYtiukeIA/s1600/dungeon_light_blending3_small.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLEbOS8xVkh2T7lCHlWSrawkxjE1tZIHJTTlItiTbE_RZPM3Smc381B1czp_uCgP901vI7zKutowoVBNTQuMyTv4nx6ShnVk3DJwCEWisBrQ1ZtQRan9VHGbYMWFBQD1PuRMcYtiukeIA/s320/dungeon_light_blending3_small.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
In the last post I made, There&#39;s a picture of the light after only using the bresenham algorithm to check what tiles are directly affected by light. I am still doing that, but right after I do some processing where I check surrounding tiles and spreed the light to unlit tiles. After that I start calculating light based on the tiles corners. I am drawing all tiles with a color value at all 4 corners so it&#39;s not always an even color over one tile.&lt;br /&gt;
&lt;br /&gt;
There are still some problems with it, but think I will leave it as it is for now. It will probably not make more people play the game. Game contents are going to bring people back for more, not visual perfection..... I hope.&lt;br /&gt;
&lt;br /&gt;
On a side note, doing the lights was really fun, I have never done that before. It&#39;s instant satisfaction when things starts working. There&#39;s hundreds of hours of tweaking left, but it&#39;s time to move on.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/5437947944344920207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2011/12/lighting-light-map-and-post-processing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/5437947944344920207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/5437947944344920207'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2011/12/lighting-light-map-and-post-processing.html' title='Lighting, light map and post processing'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLEbOS8xVkh2T7lCHlWSrawkxjE1tZIHJTTlItiTbE_RZPM3Smc381B1czp_uCgP901vI7zKutowoVBNTQuMyTv4nx6ShnVk3DJwCEWisBrQ1ZtQRan9VHGbYMWFBQD1PuRMcYtiukeIA/s72-c/dungeon_light_blending3_small.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-2503849507711055708</id><published>2011-12-27T23:55:00.000+01:00</published><updated>2011-12-27T23:55:25.971+01:00</updated><title type='text'>Colored lights blending</title><content type='html'>Apparently I have nothing better to do, so I found a way to blend the colored lights. It&#39;s not perfect, but it works well. I also noticed that I will have to do some post processing on my light map to blend the colors better. And my walls pickup the light from a nearby tile now, and it&#39;s not the expected effect. They now look like they get colored by a light on the wrong side of the wall.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBMCZFgNmzVuqPhYs_1WiVPeeWU-sfayEmSN_2Iz06CHpbMGTPdMdoK8HtxdPoIVe_XaJFm-aTOxe-OYbk4pprbwQuSu8R8EFlD9uERu1XN56h4d5Pe9ReA2ggIKYFKYZgBpsyrUwCqTo/s1600/dungeon_light_blending.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBMCZFgNmzVuqPhYs_1WiVPeeWU-sfayEmSN_2Iz06CHpbMGTPdMdoK8HtxdPoIVe_XaJFm-aTOxe-OYbk4pprbwQuSu8R8EFlD9uERu1XN56h4d5Pe9ReA2ggIKYFKYZgBpsyrUwCqTo/s320/dungeon_light_blending.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;I think I might skip the wall getting it&#39;s color from a nearby tile and work out another way to color them. Right now a &quot;blocked&quot; til cant have a light value calculated for it as it stops the line of sight algorithm. So a special case might be to check the light&#39;s effect on a blocked tile even if it&#39;s blocked, then save it if the light can reach it.&lt;br /&gt;
&lt;br /&gt;
The light map is only for static lights, I will have to run through a list of dynamic lights and calculate them separately.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/2503849507711055708/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2011/12/colored-lights-blending.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/2503849507711055708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/2503849507711055708'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2011/12/colored-lights-blending.html' title='Colored lights blending'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBMCZFgNmzVuqPhYs_1WiVPeeWU-sfayEmSN_2Iz06CHpbMGTPdMdoK8HtxdPoIVe_XaJFm-aTOxe-OYbk4pprbwQuSu8R8EFlD9uERu1XN56h4d5Pe9ReA2ggIKYFKYZgBpsyrUwCqTo/s72-c/dungeon_light_blending.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-5979131544361311391</id><published>2011-12-27T21:43:00.000+01:00</published><updated>2011-12-27T21:52:08.025+01:00</updated><title type='text'>Light map and line of sight</title><content type='html'>I implemented Bresenham&#39;s line algorithm and used it to calculate the light&#39;s path on the map, then added it to the light map. It needs a bits of smoothing to look good, light spilling over into unlighted tiles. But it works great.&lt;br /&gt;
&lt;br /&gt;
The walls are not affected by the light yet, as they need to check the tile next to it and not it&#39;s own til to determine how much light it gets. &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhji9PeDGwNsggkZB7Gj7M4drBHppt56RwPfMPZfoq2OIPq2YEwgwTfvrWWqldrl_M83qyVnMlJt6W6Eevu1eerbXYWpDK5WMCO59xtVXkncrBDEYCk6nFQeZKjEfagT_gw4Zdok4HM0QQ/s1600/dungeon_light2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhji9PeDGwNsggkZB7Gj7M4drBHppt56RwPfMPZfoq2OIPq2YEwgwTfvrWWqldrl_M83qyVnMlJt6W6Eevu1eerbXYWpDK5WMCO59xtVXkncrBDEYCk6nFQeZKjEfagT_gw4Zdok4HM0QQ/s320/dungeon_light2.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;I might have to expand my light map to hold a light value for each corner of the tile. It should make it look less like blocks. &lt;br /&gt;
&lt;br /&gt;
I found an easy description of Bresenham&#39;s line algorithm here &lt;a href=&quot;http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm&quot; target=&quot;_blank&quot;&gt;wiki/Bresenhams_line_algorithm&lt;/a&gt; just scroll down to the simplification, My version looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static boolean isVisibleFrom(int startX, int startY, int endX, int endY, Map map){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; int dx = Math.abs(endX - startX);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; int dy = Math.abs(endY - startY);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; int sx;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (startX &amp;lt; endX)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; sx = 1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; sx = -1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; int sy;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (startY &amp;lt; endY)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; sy = 1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; sy = -1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; int err = dx-dy;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; int mapX = startX;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; int mapY = startY;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; int tempError;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; while(true){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Tile tile = map.getTile(mapX, mapY);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (tile != null){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (tile.isBlocking()) return(false);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (mapX == endX &amp;amp;&amp;amp; mapY == endY) break;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; tempError = 2*err;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (tempError &amp;gt; -dy){ &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; err = err - dy;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; mapX = mapX + sx;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (tempError &amp;lt;&amp;nbsp; dx){ &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; err = err + dx;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; mapY = mapY + sy; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return(true);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
I basically just runs through my map until i hit a tile that is blocking, then stop.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/5979131544361311391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2011/12/light-map-and-line-of-sight.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/5979131544361311391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/5979131544361311391'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2011/12/light-map-and-line-of-sight.html' title='Light map and line of sight'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhji9PeDGwNsggkZB7Gj7M4drBHppt56RwPfMPZfoq2OIPq2YEwgwTfvrWWqldrl_M83qyVnMlJt6W6Eevu1eerbXYWpDK5WMCO59xtVXkncrBDEYCk6nFQeZKjEfagT_gw4Zdok4HM0QQ/s72-c/dungeon_light2.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-625449725945359205.post-5425372888490988946</id><published>2011-12-27T20:32:00.000+01:00</published><updated>2011-12-27T20:32:18.559+01:00</updated><title type='text'>Line of sight and light</title><content type='html'>I was working on some light for the game, and have implemented a very simple ambient light, it basically just draws everything with a filter to make it appear darker. It was the first step in my lighting idea. I want to add a light map on top of that so I can pre calculate all static lights and just add those values to the ambient light. That will give me instant light at minimum fps cost. Only lost about 100 fps adding ambient light. I still havn&#39;t optimized anything, so still doing a lot of overdraw.&lt;br /&gt;
&lt;br /&gt;
I have added a single light at the start position of the map to show what it looks like. I have turned ambient light down to 0 to better show the light.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEehtaHpxyP8BajoJr9LyyHK6L3AOL_sMS6Wnl2qC2Pz-0_VG5ZKOHbIaWLAS18fx2hyXqwWbzMeI7sXxFJ3vqUVFxwLmTTKH7Pf35jcCEsDxZnlOFjVIa3lrkNZ29oLL4Gwh_MtkwoMo/s1600/dungeon_light.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEehtaHpxyP8BajoJr9LyyHK6L3AOL_sMS6Wnl2qC2Pz-0_VG5ZKOHbIaWLAS18fx2hyXqwWbzMeI7sXxFJ3vqUVFxwLmTTKH7Pf35jcCEsDxZnlOFjVIa3lrkNZ29oLL4Gwh_MtkwoMo/s320/dungeon_light.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
It supports colors as well, I can set rgb colors. Right now I am not sure how I can blend them if multiple colored lights are next to each other. But I will figure that out when I get the light map to work.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbutIYexRkK4UnHJRLDSVe3RKf6qo_F3YR9wQ3P_sSSkW0U9gO_4jGw5x5U5ILlG9362FVT_SfsMCj3qfh_RY4IE9jhO0b46m0oqz4DlQumg3MgoSV6aq-ftCuTNi-JyjJrSHlRfZl3n4/s1600/dungeon_light_green.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;248&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbutIYexRkK4UnHJRLDSVe3RKf6qo_F3YR9wQ3P_sSSkW0U9gO_4jGw5x5U5ILlG9362FVT_SfsMCj3qfh_RY4IE9jhO0b46m0oqz4DlQumg3MgoSV6aq-ftCuTNi-JyjJrSHlRfZl3n4/s320/dungeon_light_green.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&amp;nbsp;The light passes through walls at the moment, but that should be fairly easy to fix by implementing a line of sight algorithm. I am thinking Bresenham&#39;s line algorithm, implemented one years ago, worked well back then, so should do the job now as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;A line of sight algorithmic can also be used for other things, like making npc&#39;s detect the player. Ranged attacks will need it to work. Maybe even only drawing tiles that are visible to the player so he cant see enemies sneaking up on him. A lot of fun possibilities.</content><link rel='replies' type='application/atom+xml' href='http://programmingjava2d.blogspot.com/feeds/5425372888490988946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programmingjava2d.blogspot.com/2011/12/line-of-sight-and-light.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/5425372888490988946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/625449725945359205/posts/default/5425372888490988946'/><link rel='alternate' type='text/html' href='http://programmingjava2d.blogspot.com/2011/12/line-of-sight-and-light.html' title='Line of sight and light'/><author><name>Rasp</name><uri>http://www.blogger.com/profile/13818419755549814782</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEehtaHpxyP8BajoJr9LyyHK6L3AOL_sMS6Wnl2qC2Pz-0_VG5ZKOHbIaWLAS18fx2hyXqwWbzMeI7sXxFJ3vqUVFxwLmTTKH7Pf35jcCEsDxZnlOFjVIa3lrkNZ29oLL4Gwh_MtkwoMo/s72-c/dungeon_light.jpg" height="72" width="72"/><thr:total>0</thr:total></entry></feed>