Only declare fields that are absolutely necessary (for values and references to objects that need to be retained from one act cycle to the next. Wow! You need to clean things up first - way too many fields (some unnecessary/some not used) the code is way too bulky (much can be done to improve here) way too many commented lines (maybe not) poor use of static fields (definitely). If (isTouching(Hero.class) & killing = false) RegularPlatform regularPlatform = new RegularPlatform() RegularPlatform theWorld = (RegularPlatform) getWorld() Īctor ground = getOneObjectAtOffset( lookForEdge, lookForGroundDistance, RegularPlatform.class) int movespeed = RegularPlatform.getSpeed() + 3 Private int lookForEdge = (int)spriteWidth/2 Private int lookForGroundDistance = (int)spriteHeight/2 Private int spriteWidth = getImage().getWidth() - 260 Private int spriteHeight = getImage().getHeight() - 350 Image.scale(image.getWidth() - 260, image.getHeight() - 350) * Act - do whatever the Alien wants to do. * Write a description of class Alien here. if platform gets to edge then either respawn back at x is 0, WHILE TOUCHING THE PLATFORM X OF HERO EQUALS GETX OF PLATFORM, ELSE IT IS ITS OWN THING. image.scale(image.getWidth() - 60, image.getHeight() - 25) Int guess = Greenfoot.getRandomNumber (2) Int yValue = Greenfoot.getRandomNumber(450) + 110 Īctor under = getOneObjectAtOffset (0, 100 / 2, RegularPlatform.class) Public int speed = Greenfoot.getRandomNumber(3) + 1 Actor offset = (RegularPlatform) getOneObjectAtOffset (0, 40, RegularPlatform.class) addObject(platforms, platformX,platformY) int platformY = Greenfoot.getRandomNumber (600) int platformX = Greenfoot.getRandomNumber (1) for (int i = 0 i < platforms.length i++) RegularPlatform platforms = new RegularPlatform int amount = Greenfoot.getRandomNumber (4) int y = Greenfoot.getRandomNumber(600) // RegularPlatform Reg1 = new RegularPlatform() int y = Greenfoot.getRandomNumber(600) RegularPlatform Reg1 = new RegularPlatform() int num = Greenfoot.getRandomNumber(500) Image.scale(image.getWidth() - 760, image.getHeight() - 325) * the 'Act' or 'Run' button gets pressed in the environment. * Act - do whatever the Platform wants to do. Public class RegularPlatform extends Actor * Write a description of class Platform here. This is the method I am referencing here at the bottm tLocation (RegularPlatform.getXplatform(), 100) tryna get it so that some spawn form left or just when it hits left go backĪddObject (aliens, platformX1, platformY1 - 70) ĪddObject (aliens, platformX2, platformY2 - 70) tLocation(platformX+40, platformY + 40) RegularPlatform = getOneObjectAtOffset (platformX, platformY, RegularPlatform.class) Actor offset = (RegularPlatform) getOneObjectAtOffset (0, 40, RegularPlatform.class) int platformY = Greenfoot.getRandomNumber (450) + 110 ĪddObject(platforms, platformX,platformY) Int platformY = Greenfoot.getRandomNumber (450) + 110 Int platformX = Greenfoot.getRandomNumber(1100) int platformX = Greenfoot.getRandomNumber(1100) guess = Greenfoot.getRandomNumber (2) RegularPlatform platforms = new RegularPlatform įor (int i = 0 i < platforms.length i++) Int misslesY = Greenfoot.getRandomNumber (600) ĪddObject(missiles, misslesX, misslesY) Int rand = Greenfoot.getRandomNumber (2) įor (int i = 0 i < missiles.length i++) int amount = Greenfoot.getRandomNumber (0) RegularPlatform regularplatform = new RegularPlatform() * That is: create the initial objects and add them to the world. * Prepare the world for the start of the program. Create a new world with 600x400 cells with a cell size of 1x1 pixels. * Constructor for objects of class MyWorld. * Write a description of class MyWorld here. Import greenfoot.* // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |