1 year ago

#388383

test-img

Text Code

How can I add a better platform Algorithm to my game?

(Java code)

Ever heard of Doodle Jump? If so, I'm trying to mimic the way they do their platforms. (Endless runner style) they seem so evenly spread out even with the monsters and blackholes they have within the game. Currently this is what my layout for adding platforms looks like and something just seems off about it. If someone could please help me with a better way.

public void addNewPlatform() {
    int platformAmount[] = new int[500];
    for (int i = 0; i < platformAmount.length; i++) {
        int x = (int) (platformAmount[i] + 400 * Math.random());
        int y = -i * 64;
        handler.object.add(new Platform(Id.plank, x, y, ss, random.nextInt(4), handler));
        System.out.println("count of pads " + y);
    }
    
}

java

2d

0 Answers

Your Answer

Accepted video resources