I am trying to change the value of the text only if a specific string is shown and the enter key is pressed. This is what I have so far in my world class:
This is what I've attempted from my text class act method:
Where am I going wrong with it?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | //variable in world class public Text inGameText; //inside constructor inGameText = new Text( "" ); // method in world class public Text getText() { return inGameText; } // initial text added to world addObject(inGameText, 147 , 289 ); inGameText.setText(inGameText.palletTown_Sign1); |
1 2 3 4 5 | CreateMap C = (CreateMap)getWorld(); Text inGameText = C.getText(); if (Greenfoot.isKeyDown( "enter" ) && C.getText() == palletTown_Sign1) { } |