Hai semua, kali ini aku akan mencoba membuat game-game sederhana menggunakan Scratch. Aku mengikuti tutorial yang diberikan Kevin Briggs dari akun Youtubenya.
Nama : Zahrul Zizki D NRP : 05111740000168 Kelas : PBO-B Tugas : Fox And Rabbit Rabbit import java.util.List; import java.util.Random; /** * A simple model of a rabbit. * Rabbits age, move, breed, and die. * * @author David J. Barnes and Michael Kolling * @version 2008.03.30 */ public class Rabbit { // Characteristics shared by all rabbits (static fields). // The age at which a rabbit can start to breed. private static final int BREEDING_AGE = 5; // The age to which a rabbit can live. private static final int MAX_AGE = 40; // The likelihood of a rabbit breeding. private static final double BREEDING_PROBABILITY = 0.15; // The maximum number of births. private static final int MAX_LITTER_SIZE = 4; // A shared random number generator to control breeding. private static final Random rand = Randomizer.getRandom(); // Individual characteristics (instance fields). // The rabbit...
Nama : Zahrul Zizki Dinanto NRP : 05111740000168 Kelas : PBO-B Terdapat 4 class yang digunakan untuk membuat Game Pong Java: 1. Renderer 2. Paddle 3. Ball 4. Pong 1. Class Ball /** * Source Code untuk Class Ball * @author (Zahrul Zizki Dinanto) * @NRP(05111740000168) */ import java.awt.Color; import java.awt.Graphics; import java.util.Random; public class Ball { public int x, y, width = 25, height = 25; public int motionX, motionY; public Random random; private Pong pong; public int amountOfHits; public Ball(Pong pong) { this.pong = pong; this.random = new Random(); spawn(); } public void update(Paddle paddle1, Paddle paddle2) { int speed = 5; this.x += motionX * speed; this.y += motionY * speed; if (this.y + height - motionY > pong.hei...
Komentar
Posting Komentar