This site requires JavaScript, please enable it in your browser!
Greenfoot back
Blhaar2014
Blhaar2014 wrote ...

2014/1/19

Determine right or wrong

1
2
3
4
Blhaar2014 Blhaar2014

2014/1/20

#
My Button class is completely empty, which even for me comes as sort of a surprise right now. Got me wondering why I made the seperate "Button" actor in the first place.... oh well, it's empty;
public class Button extends Actor
{
    /**
     * Act - do whatever the Button wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        // Add your action code here.
    }    
}
danpost danpost

2014/1/20

#
Well, the problem is obviously not there. Where else can we look?
Blhaar2014 Blhaar2014

2014/1/20

#
[Disallowed URL] I hope this works, but if the image shows you can see how all my actors are lined up.
Blhaar2014 Blhaar2014

2014/1/20

#
hmm well let's see, I have the "Button" (Toestaan & Weigeren) oh well, I have one actor left with quite a lot of code, and that's the heart we discussed earlier on. could that be part of it all?
danpost danpost

2014/1/20

#
Maybe you should upload it on the side (including publishing the source code) so I can get a first-hand look at it. There is a checkbox that needs to be checked to 'Publish source code' within the 'Share' window.
Blhaar2014 Blhaar2014

2014/1/20

#
Its called MiniGame1 , I hope you can find whatever's been bugging, well, us for the past 10 hours haha!
danpost danpost

2014/1/20

#
Got it. You can delete it now, if you wish.
Blhaar2014 Blhaar2014

2014/1/20

#
alright, are you going to first-hand change things and send the altered one, or give me hints while looking at my game itsself? Both ways are fine by me!
danpost danpost

2014/1/20

#
I am going to do what we have been doing all along. First, remove all the code from your 'Toestaan' class. Then (this is what we forgot), in the world class act method, change the 'else' part to this:
else
{
    if ((Greenfoot.mouseClicked(deny) && matching) || (Greenfoot.mouseClicked(allow) && !matching))
    {
        heart.adjustValue(-1);
        if (heart.getValue() == 0) Greenfoot.stop();
    }
    if (Greenfoot.mouseClicked(deny) || Greenfoot.mouseClicked(allow))
    {
        removeObjects(getObjects(Photo.class));
        removeObjects(getObjects(Idcard.class));
    }
}
Blhaar2014 Blhaar2014

2014/1/20

#
ow now it was that the keys were only working when a heart could be deleted, but we forgot to make the keys work under matches as well?
Blhaar2014 Blhaar2014

2014/1/20

#
It works man, Great!! Now I have one final question, since it worked that way before. How do I link the "GameOverScreen" in such way that it pops up when the hearts are depleted? Thanks for all your help, I really appreciate it!
danpost danpost

2014/1/20

#
Blhaar2014 wrote...
How do I link the "GameOverScreen" in such way that it pops up when the hearts are depleted? Thanks for all your help, I really appreciate it!
Replace 'Greenfoot.stop()' in line 6 above with 'Greenfoot.setWorld(new GameOverScreen());'.
Blhaar2014 Blhaar2014

2014/1/20

#
Thanks man, you've been a great help!! In fact you did all the hard work hahah! See you around on the forum, and have a nice day!
You need to login to post a reply.
1
2
3
4