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

2020/4/14

Help with multi-key macro

1
2
3
danpost danpost

2020/4/21

#
444Jam444 wrote...
I replaced Calculate calculate = new Calculate(); with Calculate calculate = ((Calculator)getWorld()).myCalculator; Was I supposed to replace? Or just delete and use Calculate calculate = ((Calculator)getWorld()).myCalculator; within methods?
Only use what I gave within the method. Delete the field above the constructor (with no replacement there).
444Jam444 444Jam444

2020/4/22

#
I deleted the field above the constructor (line 19 of button) and then put
Calculate calculate = ((Calculator)getWorld()).myCalculator;
on line 19 of button. Am I supposed to put this line of code in methods instead of above the constructor? Because the code is causing an error...
danpost danpost

2020/4/22

#
444Jam444 wrote...
I deleted the field above the constructor (line 19 of button) and then put << Code Omitted on line 19 of button. Am I supposed to put this line of code in methods instead of above the constructor? Because the code is causing an error...
Put it in any and all methods where needed.
444Jam444 444Jam444

2020/4/22

#
Right will do. I’ll get back to you on the results, I’m not currently at my computer.
444Jam444 444Jam444

2020/4/24

#
It works without throwing an exception in the terminal, but there's still the issue of currentIndex not increasing at all within Calculate class, and a new issue of ... Never mind, I made a couple small changes while typing this message which fixed these issues. All I had to do was change '//world.updateDisplay();' from a comment to code (in button class) and add 'Calculator world = ((Calculator)getWorld());' a couple lines above it. For some reason, hitting an operator throws an exception, but I haven't tried resolving that issue so I'll post another reply if I'm having difficulties with it. Should likely be a simple fix (hopefully). Edit: It's because the add method in calculate is unfinished. Easy enough to solve, I'll get working on that.
You need to login to post a reply.
1
2
3