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

2013/3/14

Using getObjectsAt()

1
2
danpost danpost

2013/3/17

#
Remove the '&& b.blockStatus==0' from line 16. I went ahead and created a scenario of my own just then using some of the code above (with modifications, of course) to figure out what needed done. Mine probably is not quite like yours, so I could not just show you the code and it work for you. What is needed at line 11 is the following check: if no neighbouring bombs exists And, what is needed at line 16 is: if not yet clicked (or triggered). You should probably not remove any blocks at all. The fields within each block can determine everything you need to know and show. The 'updateBlock' method should only be called once per game on any block, and can be used to change the 'isClicked' value as well as the current image. The 'onClick' method can call the updateBlock method on each triggered block, so line 19 can be removed, as well as the final 'else' clause/block.
Daylend Daylend

2013/3/17

#
Alright, so I got everything working. I took pieces of what you said and applied them to the code. What I actually changed was kind of a "duh" moment for me. To fix the code, I removed line 19 as well as line 9, because as you mentioned, they were redundant. I can just put it at the top of the method. I also, instead of removing the blocks, simply changed them to the background image. (Virtually the same thing) Now everything works. I've got one last method to finish (winning), hopefully all goes well and I'll stop bugging you guys lol. Thank you for everything.
You need to login to post a reply.
1
2