Today we will add jumping with some faux physics effects.
code here
And the MyWorld code:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class MyWorld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MyWorld extends World
{
/**
* Constructor for objects of class MyWorld.
*
*/
public MyWorld()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(800, 600, 1);
prepare();
}
/**
* Prepare the world for the start of the program. That is: create the initial
* objects and add them to the world.
*/
private void prepare()
{
Player player = new Player();
addObject(player, 441, 32);
Platform platform01 = new Platform();
addObject(platform01, 10, 580);
Platform platform02 = new Platform();
addObject(platform02, 40, 580);
Platform platform03 = new Platform();
addObject(platform03, 70, 580);
Platform platform04 = new Platform();
addObject(platform04, 100, 580);
Platform platform05 = new Platform();
addObject(platform05, 130, 580);
Platform platform06 = new Platform();
addObject(platform06, 160, 580);
Platform platform07 = new Platform();
addObject(platform07, 190, 580);
Platform platform08 = new Platform();
addObject(platform08, 220, 580);
Platform platform09 = new Platform();
addObject(platform09, 250, 580);
Platform platform10 = new Platform();
addObject(platform10, 280, 580);
Platform platform11 = new Platform();
addObject(platform11, 300, 580);
Platform platform12 = new Platform();
addObject(platform12, 330, 580);
Platform platform13 = new Platform();
addObject(platform13, 360, 580);
Platform platform14 = new Platform();
addObject(platform14, 390, 580);
Platform platform15 = new Platform();
addObject(platform15, 420, 580);
Platform platform16 = new Platform();
addObject(platform16, 450, 580);
Platform platform17 = new Platform();
addObject(platform17, 480, 580);
Platform platform18 = new Platform();
addObject(platform18, 510, 580);
Platform platform19 = new Platform();
addObject(platform19, 540, 580);
Platform platform20 = new Platform();
addObject(platform20, 570, 580);
Platform platform21 = new Platform();
addObject(platform21, 600, 580);
Platform platform22 = new Platform();
addObject(platform22, 630, 580);
Platform platform23 = new Platform();
addObject(platform23, 660, 580);
Platform platform24 = new Platform();
addObject(platform24, 690, 580);
Platform platform25 = new Platform();
addObject(platform25, 720, 580);
Platform platform26 = new Platform();
addObject(platform26, 750, 580);
Platform platform27 = new Platform();
addObject(platform27, 780, 580);
Platform platform28 = new Platform();
addObject(platform28, 810, 580);
}
}
No comments:
Post a Comment