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

2019/2/4

Problems adding actors-scrollworld

Andrew.2 Andrew.2

2019/2/4

#
You might remember me i asked for help making layered tanks. I just added the scrollworld world to my game, basically just copied my actors over and changed a few things. The main tank and enemy tanks can shoot projectiles, but now if more than one projectile is spawned i get a null pointer exception. The first projectile spawns fine but the 2nd one doesnt. And its the same problem for all 3 types of projectiles.
danpost danpost

2019/2/4

#
Andrew.2 wrote...
You might remember me i asked for help making layered tanks. I just added the scrollworld world to my game, basically just copied my actors over and changed a few things. The main tank and enemy tanks can shoot projectiles, but now if more than one projectile is spawned i get a null pointer exception. The first projectile spawns fine but the 2nd one doesnt. And its the same problem for all 3 types of projectiles.
I would suggest you use my Scroller class, even if it is my ScrollWorld class you were trying to implement. I have a tutorial on scrolling plus a demo of the Scroller class. Just search "scroller tutorial". Main reason is the ScrollWorld class tries to take too much control from the world and makes it harder to work with. Plus, it is limited to a specific type of scrolling, where the Scroller class is feasible for all types of scrolling (as seen by the demo).
Andrew.2 Andrew.2

2019/2/4

#
ok i'll try it. is it the sworld class on your profile?
danpost danpost

2019/2/4

#
Andrew.2 wrote...
ok i'll try it. is it the sworld class on your profile?
No. The Scroller class with this tutorial and this demo.
Andrew.2 Andrew.2

2019/2/4

#
ok thanks!
Andrew.2 Andrew.2

2019/2/4

#
I'm still having problems here i added the scroller class, made a world, basically just took the code from the tutorial but it seems like it won't scroll beyond one tile. I have some random 300x300 tile and i had to set HIGH and WIDE to 200 just to get any scrolling, and it stops once it reaches the end of one tile.
Andrew.2 Andrew.2

2019/2/4

#
nevermind i fixed it
You need to login to post a reply.