<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Greenfoot Discuss</title>
    <link>http://www.greenfoot.org/topics</link>
    <description>The latest Greenfoot discussion posts</description>
    <language>en-us</language>
    <item>
      <title>Reply to What program should I use to make the sprites for my programs?</title>
      <description>Personally, I have GameMaker. While in of itself isn't for spriteing, but it does have a sprite maker which is really good (does transparent well). The only downside that I found is that there is a certain size limit.. Unless you can make the area bigger, I haven't found that out yet. Other good part of the sprite maker is that it has a blend tool, making some colors you usually can't get easily. Just my two cents on the subject.</description>
      <author>Zyphos</author>
      <pubDate>Wed, 16 May 2012 22:29:40 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1491?pid=9095#post_9095</link>
    </item>
    <item>
      <title>Reply to What program should I use to make the sprites for my programs?</title>
      <description>Incidentally, I use Gimp but was able to make transparent backgrounds work properly. I am using it for my &lt;a href="http://www.greenfoot.org/scenarios/4938"&gt;Emu Joust&lt;/a&gt; scenario.</description>
      <author>davmac</author>
      <pubDate>Wed, 16 May 2012 22:00:44 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1491?pid=9094#post_9094</link>
    </item>
    <item>
      <title>Reply to What program should I use to make the sprites for my programs?</title>
      <description>well I sometimes use gimp but mainly Microsoft power-point (it has a remove background thing):D</description>
      <author>tylers</author>
      <pubDate>Wed, 16 May 2012 21:59:19 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1491?pid=9093#post_9093</link>
    </item>
    <item>
      <title>Reply to Making yourself null</title>
      <description>Thanks for the explanations!</description>
      <author>SPower</author>
      <pubDate>Wed, 16 May 2012 19:37:58 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1488?pid=9092#post_9092</link>
    </item>
    <item>
      <title>Reply to Changing Levels</title>
      <description>Sounds good,
thank you for your help!</description>
      <author>dark_sky</author>
      <pubDate>Wed, 16 May 2012 18:18:59 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1489?pid=9091#post_9091</link>
    </item>
    <item>
      <title>Reply to What program should I use to make the sprites for my programs?</title>
      <description>paint.net is my friend, you can get it at http://www.getpaint.net :d</description>
      <author>charleson</author>
      <pubDate>Wed, 16 May 2012 17:26:06 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1491?pid=9090#post_9090</link>
    </item>
    <item>
      <title>Reply to Changing Levels</title>
      <description>&lt;span class="bb_strike"&gt;what do you exactly mean with constant level?&lt;/span&gt;
I would program it so, that the constructor of the door needs an int and with switch-case you can change the world then.</description>
      <author>erdelf</author>
      <pubDate>Wed, 16 May 2012 17:13:27 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1489?pid=9089#post_9089</link>
    </item>
    <item>
      <title>Reply to Changing importance of overlapping objects</title>
      <description>Thanks! This answer is exactly what I was looking for.</description>
      <author>MrDoomsday</author>
      <pubDate>Wed, 16 May 2012 17:04:56 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1490?pid=9088#post_9088</link>
    </item>
    <item>
      <title>Reply to How can i detect the edge of the world?</title>
      <description>I used this code to make it sort of bounce off the edges but I'm still working on it:
&lt;div class="bb_code_wrap"&gt;&lt;textarea name="code" class="java"&gt;        if (getX() &amp;lt;= 15)
        {
            setRotation(getRotation() + 80);
        }
        if (getY() &amp;lt;= 15)
        {
            setRotation(getRotation() + 80);
        }
        if (getX() &amp;gt;= getWorld().getWidth() - 15)
        {
            setRotation(getRotation() + 80);
        }
        if (getY() &amp;gt;= getWorld().getHeight() - 15)
        {
            setRotation(getRotation() + 80);
        }&lt;/textarea&gt;&lt;/div&gt;
You could change the distance by changing the number so it fits the size of of your object. Or you could also change the angle by changing the number in the set rotation method.</description>
      <author>steved</author>
      <pubDate>Wed, 16 May 2012 16:42:49 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1481?pid=9087#post_9087</link>
    </item>
    <item>
      <title>Reply to Changing importance of overlapping objects</title>
      <description>If they are of different 'type's, and you always want one 'type' above another, you can use the setPaintOrder method in the World class (that is the easy one to arrange).
If they are of different 'type's, but do not always want one 'type' above the other, or if they are of the same type, you can arrange them as needed on the fly.  You accomplish this by taking the object you want to be above the other, and after saving its getX() and getY() in variables, remove it from the world and re-insert it at the same location by using the co-ordinates you had saved.</description>
      <author>danpost</author>
      <pubDate>Wed, 16 May 2012 16:38:24 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1490?pid=9086#post_9086</link>
    </item>
    <item>
      <title>Reply to What program should I use to make the sprites for my programs?</title>
      <description>Does anyone know a good free program for editing and creating png images without backgrounds? I have a image editor called Gimp but it makes the whole image partially transparent so I'm looking for a new one.</description>
      <author>steved</author>
      <pubDate>Wed, 16 May 2012 16:37:41 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1491?pid=9085#post_9085</link>
    </item>
    <item>
      <title>Reply to Changing importance of overlapping objects</title>
      <description>When the images of some of my objects overlap only one of them is shown because it is more in the foreground. How can I swap them so the other object is actually in the foreground when it tries to overlap another object?</description>
      <author>MrDoomsday</author>
      <pubDate>Wed, 16 May 2012 16:32:48 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1490?pid=9084#post_9084</link>
    </item>
    <item>
      <title>Reply to Changing Levels</title>
      <description>Hello everyone, 
I'm coding a little platforming game which contains several levels. To do that, I wrote a &amp;quot;BaseLevel&amp;quot;-class which holds objects which appear in every level (for example a life counter). Then the levels are subclasses of BaseLevel. The levels themselves have a prepare() method, which adds platforms etc. to the world. In my player class, I defined a method which is being called when the player intersects with a &amp;quot;LevelDoor&amp;quot;. I use Greenfoot.setWorld(...) to set the new world. Now my question is, how to make it possible to go to the next level. I only get it working with a constant level, like Greenfoot.setWorld(new Level2()). Maybe you can help me.
Thank you
George</description>
      <author>dark_sky</author>
      <pubDate>Wed, 16 May 2012 16:23:59 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1489?pid=9083#post_9083</link>
    </item>
    <item>
      <title>Reply to Making yourself null</title>
      <description>&amp;gt;Mjrb4, great response. 

When optimising my code, I always look to reuse objects were possible, rather than allowing them to be released, garbage collected just because I need to create a new one of the same type, but with different data. Images are a prime example of something worth considering for reuse; where possible.</description>
      <author>sp33dy</author>
      <pubDate>Wed, 16 May 2012 15:58:23 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1488?pid=9082#post_9082</link>
    </item>
    <item>
      <title>Reply to the necessity of public and private</title>
      <description>There's 4 levels of visibility in Java - two are public and private, another is protected and the 4th is &amp;quot;package private&amp;quot;. The 4th is different because it has no keyword, it's the &amp;quot;default&amp;quot; visibility per-se, which is what you get if you leave public / private off.

Your code may still work when using the default visibility since usually in Greenfoot all your code is in the same package, but unless you're dealing with packages and specifically want package private access for some reason, you should still use pick a visibility modifier for good practice.</description>
      <author>mjrb4</author>
      <pubDate>Wed, 16 May 2012 15:57:39 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1485?pid=9081#post_9081</link>
    </item>
    <item>
      <title>Reply to Making yourself null</title>
      <description>&lt;div class="bb_quote"&gt;&lt;div class="bb_quote_header"&gt;SPower wrote...&lt;/div&gt;&lt;p&gt;I'm trying to give the garbage collection less to do: if you're null, the garbage collector has less to do.&lt;/p&gt;&lt;/div&gt;

A few years ago this was an entirely valid thing to do, these days the garbage collector is extremely good at what it does and there's really no need - it counts entirely as premature optimisation (which is a bad thing.) It doesn't really give it &amp;quot;less to do&amp;quot; per se either since it still has to collect unreferenced objects either way; all you're doing is (perhaps) providing the potential for that object to be collected a bit earlier. If you're having issues with garbage collection then chances are you need to do something else to solve it, this isn't the solution!

Note though that as already said, &amp;quot;this&amp;quot; is a final keyword - you can't set it to anything else, null included (to allow that would allow all sorts of bizarre behaviour with weird side effects.)</description>
      <author>mjrb4</author>
      <pubDate>Wed, 16 May 2012 15:49:28 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1488?pid=9080#post_9080</link>
    </item>
    <item>
      <title>Reply to Making yourself null</title>
      <description>Here's a great link (look for the response to the post). It's pretty detailed.

&lt;a href="http://stackoverflow.com/questions/5690309/garbage-collector-in-java-set-an-object-null"&gt;Great explanation&lt;/a&gt;</description>
      <author>sp33dy</author>
      <pubDate>Wed, 16 May 2012 15:22:57 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1488?pid=9079#post_9079</link>
    </item>
    <item>
      <title>Reply to Stopping at walls</title>
      <description>Weird: why do you want to convert a wall into a player object?
Just do this:
&lt;div class="bb_code_wrap"&gt;&lt;textarea name="code" class="java"&gt;public void checkCollision()  
{  
      Actor a = getOneIntersectingObject(Wall_1.class);  
      if (a != null)      
      {      
          getWorld().removeObject(this);  
      }      
}&lt;/textarea&gt;&lt;/div&gt;
This will remove the object which holds this method (I assume that is a player) when it hits a wall. I make an Actor object, because getOneIntersectingObject will only return an object if it sees a wall object.</description>
      <author>SPower</author>
      <pubDate>Wed, 16 May 2012 15:19:30 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1473?pid=9078#post_9078</link>
    </item>
    <item>
      <title>Reply to Stopping at walls</title>
      <description>So i have this code...

&lt;div class="bb_code_wrap"&gt;&lt;textarea name="code" class="java"&gt;    public void checkCollision()
    {
          Player thePlayer = null;
          thePlayer = (Player)getOneIntersectingObject(Wall_1.class);
          if (thePlayer != null)    
          {    
              getWorld().removeObject(thePlayer);
          }    
    }&lt;/textarea&gt;&lt;/div&gt;

I would like when the player runs into the wall the player is removed...but with the code i have now, when i run into the wall, it crashes the program and gives me an error message saying:

java.lang.ClassCastException: Wall_1 cannot be cast to Player</description>
      <author>TheYoung0ne</author>
      <pubDate>Wed, 16 May 2012 15:15:50 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1473?pid=9077#post_9077</link>
    </item>
    <item>
      <title>Reply to Making yourself null</title>
      <description>Yeah, buyt an object which is null stands on the heap, will GC delete it or not? It that what you mean with:
&lt;div class="bb_quote"&gt;&lt;div class="bb_quote_header"&gt;sp33dy wrote...&lt;/div&gt;&lt;p&gt;Also, nulling and object can be the root of memory leaks.&lt;/p&gt;&lt;/div&gt;</description>
      <author>SPower</author>
      <pubDate>Wed, 16 May 2012 15:13:48 +0000</pubDate>
      <link>http://www.greenfoot.org/topics/1488?pid=9076#post_9076</link>
    </item>
  </channel>
</rss>

