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

stevenGrohe's collections

This user has no collections

Recent Comments | Show All

stevenGrohe

2012/7/1

how can I share the source code?
stevenGrohe

2012/6/26

I donĀ“t really know whether you mean this, but I think so: import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) public class NextLevel extends HUD { public int alpha; private int fadeKind; private int fadeSpeed = 4; public boolean active = true; public int xAdd; public int yAdd; private Level lv; public NextLevel() { fadeKind = 0; //0 = fade out, 1 = fade in alpha = 0; getImage().setTransparency(alpha); xAdd = 320; yAdd = 240; lv = (Level)getWorld(); } public void act() { getImage().setTransparency(alpha); if (fadeKind == 0) { if ((alpha + fadeSpeed) <= 255) { alpha += fadeSpeed; } else { fadeKind = 1; alpha = 255; lv.finished = false; CONSTS.nextLevel(); lv.mustRestart = true; } } else { if ((alpha - fadeSpeed) >= 0) { alpha -= fadeSpeed; } else { alpha = 0; if (CONSTS.current_level != CONSTS.level_amount) lv.running = true; getWorld().removeObject(this); } } setLocation((int)View.get_x()+xAdd,(int)View.get_x()+yAdd); } public int getAlpha() { return alpha; } public int getx() { return xAdd; } public int gety() { return yAdd; } public void setState(int st) { fadeKind = st; } }