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

2011/12/13

A very strange nullPointer...

1
2
kiarocks kiarocks

2011/12/14

#
On the second one, that is.
AwesomeNameGuy AwesomeNameGuy

2011/12/14

#
Looks like they beat me to it.
kiarocks kiarocks

2011/12/14

#
Who's they?
kiarocks kiarocks

2011/12/14

#
Oh, me and davmac.
darkmist255 darkmist255

2011/12/14

#
@davmac while I see what you mean (yes, I'm going to change that), it does work perfectly how it is in spikes (without the comments). I have tried them all with and without addedToWorld(), however I will try it again since that is logically what will work. You never know, sometimes things just don't work some days :D.
davmac davmac

2011/12/14

#
darkmist255, what version of Greenfoot are you using? The code in the Spikes class simply can't work with the current version.
darkmist255 darkmist255

2011/12/15

#
@davmac Version 2.1.2. But what part of spikes won't work? My "getWorld()" in the constructor? I've moved the references to addedToWorld(); Also, I've got it all working. I don't know why, but it just works all of a sudden. Yes, I did put it back into the addedToWorld(), I'm just analyzing the working code right now, then I should be able to avoid this in the future :D. Once again, I was probably tired and just did something stupid hehehe :D...
davmac davmac

2011/12/15

#
it does work perfectly how it is in spikes (without the comments)
I interpreted this as "it works as it is posted" - maybe that's not what you meant. I've you've moved the initialization of the variables into addedToWorld() then it makes sense. (yes, it's getWorld() in the constructor that is the problem).
darkmist255 darkmist255

2011/12/15

#
Thanks :D!
You need to login to post a reply.
1
2