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

2015/1/28

levels

howdoesonecode howdoesonecode

2015/1/28

#
i am making a shooting game and i want to make levels something basic like... when you start up this many enemies show once enemy count reaches 0 the game "resets"(not reset the program just move everything back to starting position) and adds more characters... and add a level counter if its possible
danpost danpost

2015/1/28

#
A level counter would be good. You can use it to determine how many enemies to add, etc. What do you think is involved in adding a counter to the world class (not currently worrying about displaying it at this point)?
howdoesonecode howdoesonecode

2015/1/28

#
danpost wrote...
A level counter would be good. You can use it to determine how many enemies to add, etc. What do you think is involved in adding a counter to the world class (not currently worrying about displaying it at this point)?
i would imagine i need to give a method like enemyCounter or whatever dont know parameters though im still a novice sorry
danpost danpost

2015/1/29

#
howdoesonecode wrote...
i would imagine i need to give a method like enemyCounter or whatever dont know parameters though im still a novice sorry
Even before any methods, you need a field to hold the value of the counter. Then, you can write the methods required to change or return its value.
howdoesonecode howdoesonecode

2015/1/29

#
danpost wrote...
howdoesonecode wrote...
i would imagine i need to give a method like enemyCounter or whatever dont know parameters though im still a novice sorry
Even before any methods, you need a field to hold the value of the counter. Then, you can write the methods required to change or return its value.
so what would that look like... is there a template i can use for it?
danpost danpost

2015/1/29

#
howdoesonecode wrote...
so what would that look like... is there a template i can use for it?
Maybe this page of the java tutorials might help.
howdoesonecode howdoesonecode

2015/1/29

#
danpost wrote...
howdoesonecode wrote...
so what would that look like... is there a template i can use for it?
Maybe this page of the java tutorials might help.
im in a java class i know what classes methods field types and stuff are i just need the basic code so i can modify it.
danpost danpost

2015/1/29

#
If you had a field in your world subclass to track the level number and a method (maybe called 'levelUp') that you could call in that class to increment the level number and remove/replace/reset whatever, that should be all you would need.
You need to login to post a reply.