![]() ![]() I'm not sure what I've done wrong here, nor am I sure how to fix it. When I use a blue orb while at normal gravity (spaceTimer equalling 1) my player will flip gravity perfectly fine, however when I use a blue orb while my gravity is flipped (spaceTimer equalling -1) my player will flip gravity but also jump in midair. ![]() SetLocation(getX(), objGroundY-dy*(objGroundHeight+myHeight)/2) Greenfoot memiliki alat untuk merekam suara. ![]() Di Greenfoot, metode mana yang memeriksa apakah kunci pada keyboard telah ditekan a. 3.25 Do this: Open up the Greenfoot API and look in the Greenfoot class under Method and Description for a method that will pause the execution. The method we are looking for is in the Greenfoot class. Int objGroundHeight = objGround.getImage().getHeight() Di Greenfoot anda dapat berinteraksi dengan skenario menggunakan mouse. So you can see that Greenfoot has nine classes: Actor, Color, Font, Greenfoot, GreenfootImage, GreenfootSound, MouseInfo, Userinfo, and World. If ((objGround != null) & (objGround instanceof Ground)) SetLocation(getX(), objBlockY-dy*(objBlockHeight+myHeight)/2) Īctor objGround = getOneIntersectingObject(null) Int objBlockHeight = objBlock.getImage().getHeight() If ((objBlock != null) & (objBlock instanceof Block)) If (isTouching(BlueOrbActivator.class) & spaceTimer > -1)Īctor block = getOneObjectAtOffset (0, getImage().getHeight()/2, Block.class) Īctor ground = getOneObjectAtOffset (0, getImage().getHeight()/2, Ground.class) Īctor objBlock = getOneIntersectingObject(null) Greenfoot - isKeyDown () seems to hold its value Ask Question Asked 5 years, 11 months ago Modified 5 years, 11 months ago Viewed 109 times 0 This is a sprinting function for a game, if the player has greater then 0 spring left then he can sprint, if it is at 0 the player cannot sprint. If (spaceIsDown & spaceTimer = 1 & isTouching(BlueOrbActivator.class))Įlse if (spaceIsDown & spaceTimer = -1 & isTouching(BlueOrbActivator.class)) RemoveTouching(YellowOrbActivator.class) If (spaceIsDown & isTouching(YellowOrbActivator.class)) This is how you can use it to make the crab turn a little about 10 percent of the time. If (spaceIsDown != Greenfoot.isKeyDown("space"))Įlse if (spaceIsDown & onGround() || onBlock()) Greenfoot.getRandomNumber (100) < 10 This call will give us a new random number between 0 and 99 every time it is called, so it will be under 10 in ten percent of the times it comes up. GetWorld().showText("Timer: "+spaceTimer, 50, 50) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |