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

2014/5/23

Help with level up

1
2
hugtvy hugtvy

2014/5/23

#
just make 5 classes called levels 1 to 5 then right click on them and click set image, create an image or get one from google that says levels 1 to 5 then add each one to each world and save the world so that when you go to each world its there? was that clear enough? i can rewrite it if thats too complicated aha
danpost danpost

2014/5/23

#
adi110 wrote...
if i don''t extend from sandstone i can't go in bath when i hit 15 score; i did't know how to do it in another way
Where is the code for when you hit 15 score? will it be 15 for each level?
adi110 adi110

2014/5/23

#
hugtvy, if you can write the code for every one of them and how i acces them when i hit the 15 score thank you public int maxScore = 15; public int levelUp = 120; public void act() { if(timerrrStarted) Timerrr(); Eat(); } public void eat() {if(fln != null) { World world = getWorld(); Greenfoot.playSound("slurp.wav"); world.removeObject(fln); SpawnNewFlan(); Eaten(1); Score++;} if(Score >= maxScore) { LevelComplete lvl = new LevelComplete(); world.addObject(lvl, world.getWidth()/2, world.getHeight()/2); timerrrStarted = true; complete = true; } } public void Eaten(int amount) { sandstone sand = (sandstone) getWorld(); Counter theCounter = sand.getCounter(); theCounter.bumpScore(amount); } public void Timerrr() { if(levelUp > 0) { levelUp --; if(levelUp == 0) { delayReady = true; levelUp = 120; Greenfoot.setWorld(new bath()); } } } this is my code for reaching level 2 after hit 15 score; i wrote it in my Actor sub-class snake because with him i eat the fruits and i made a delay because i wanted to create a pause between level 1 and level 2
adi110 adi110

2014/5/23

#
and the bath is extend it from world
hugtvy hugtvy

2014/5/23

#
im confused buddy, just tell me what you want step by step and ill try my best to help out aha, you want a counter that stays in a corner or something with what level ur on right? that code looks right so it should exchange the worlds, all you need is a simple method to add a jpeg, the whole counter thing would be farr too complicated, just add a new class called level 1 and set an image by right clicking it and selecting "set image.." now find a jpeg image from google or make one that says level 1 and add it to your world. do the same for levels 1-5 :) hope this helps
danpost danpost

2014/5/23

#
What you need to do is to create a base Level world for the counter and methods that all sub-worlds (that will extend the base Level world) will be using. That way, it will not matter what sub-world your actor is in, it will still be able to access the counter and utilize any methods that generic to the levels in the base Level world.
adi110 adi110

2014/5/23

#
i don't understand...i am new in greenfoot;i want to do a code when i hit the score (15) to move to level 2 and the maxScore increase by 5 so to move to level 3 i need to hit 30 and for level 4 35 for level 5 40; i don't know how to do it, can you you write the code ? please
danpost danpost

2014/5/23

#
You should probably look at my Super Level Support Class scenario.
adi110 adi110

2014/5/24

#
ok thx but what about menu?? how can i create one with 3 buttons : Start (to play the game), Quit (to close the game) and Leaderboard(to save the score of each playing) ?? can you help me with this one ?
You need to login to post a reply.
1
2