![]() ![]() First, when using 'isKeyDown' without any type of control, it is difficult to have a changing value stop at a particular number. I think there are a couple of inherent problems here. If(Greenfoot.isKeyDown("backspace")) change1=change1+speed If (Greenfoot.isKeyDown("8")) change1=change1+kør * the 'Act' or 'Run' button gets pressed in the environment. * Act - do whatever the Skydemand wants to do. String key = Greenfoot.getKey() // saves the key returned GreenfootSound reverse = new GreenfootSound("reverse.wav") GreenfootSound idle = new GreenfootSound("idle.wav") GreenfootSound turbo = new GreenfootSound("turbo.wav") GreenfootSound driving = new GreenfootSound("drive.wav") Public class nyKøremand extends SmoothMover * Write a description of class Skydemand here. can post those too.Import greenfoot.* // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) only errors elsewhere are in counter and space. I also have counter smoothmover and vector class. Private void applyGravity(paperball other)ĭouble dx = other.getExactX() - this.getExactX() ĭouble dy = other.getExactY() - this.getExactY() ĭouble distance = Math.sqrt (dx*dx + dy*dy) ĭouble strength = GRAVITY * this.mass * other.mass / (distance * distance) ĭouble acceleration = strength / this.mass ensure that we don't get too fast: If the current speed is very fast, decelerate a bit.Īccelerate (1.4) // acceleration with factor < 1 is actually slowing down. If(Greenfoot.getRandomNumber(100) paperballs = (List) getWorld().getObjects(paperball.class) Public paperball(int size, double mass, Vector movement) * Act - do whatever the paperball wants to do. Private static final double GRAVITY = 7.8 i hope to code them correctly with gravity forces for a better grade but i'm struggling at managing that as of now. * paperballs should be placed random, they should fly with a inconsistent speed and direction and be intended to *be pushed into bins. GetWorld().PushBallInNewDirection(paperball) check if user runs into paperball, if so return paperball into opposite directionĪctor user = getIntersectingObjects(0, 0, paperball.class) Int y = getY() + (int)Math.round(Math.sin(rotation)*distance) Int x = getX() + (int)Math.round(s(rotation)*distance) class expected but idk why if i have the x and y's.ĭouble angle = Math.toRadians( getRotation() ) Fromthere they can attempt to recycle more often to win. * goal is to only push paperballs in a new direction with the character of the game. * to push the paperballs into the bins and be able to move around the map with ease of arrow keys Import greenfoot.* // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) Public void setLocation(double getX, double getY)Īctor recyclingBin = getIntersectingObjects(0, 0, paperball.class) * Act - do whatever the RecyclingBin wants to do. * RecyclingBin should wait in corners(600,400,1) and just pick up flying by paperballs.Also add to the counter getCountPP?Do you guys think it should be a bigger map at all:? im t h inkin maybe Hey guys in im senior IT PCS II and im having trouble configuring all my codes here the code i need help with sry for the long txtimport greenfoot.*
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |