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

2017/11/13

text box showing up when character presses enter

1
2
3
danpost danpost

2017/11/14

#
Line 41 should read:
// If the player moved away without removing the text, remove it
jacquelinereilly jacquelinereilly

2017/11/14

#
Ok, thank you. So I am going to try and add it to the main program now. Everything else looks good?
Super_Hippo Super_Hippo

2017/11/14

#
I didn't test it but I don't see how line 42 will ever be true. If the TriggerText object doesn't touch a Player object (= the player walked away), the 'return' in line 24 would have been executed before because the player can't move between these lines. Maybe line 24 should be this instead?
if ( ! isTouching(Player.class) )
{
    if (intersects(toShow))
    {
        getWorld().removeObject(toShow);
    }
    return;
}
jacquelinereilly jacquelinereilly

2017/11/15

#
So is there a way I can have the text placed on top of the image I have for the text boxes?
Super_Hippo Super_Hippo

2017/11/15

#
Use the world method 'setPaintOrder'.
danpost danpost

2017/11/15

#
Hippo is correct. Lines 41 through 45 should be changed to what Hippo suggested and be cut and inserted at line 24.
jacquelinereilly wrote...
So is there a way I can have the text placed on top of the image I have for the text boxes?
Please indicate what "the text" and "the text boxes" are in your code (what Class of object and what variable name you gave it) for clarity.
You need to login to post a reply.
1
2
3