This site requires JavaScript, please enable it in your browser!
Greenfoot back
Alfie5
Alfie5 wrote ...

2012/2/28

key control

Alfie5 Alfie5

2012/2/28

#
This won't work what I am doing wrong? import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class player1 here. * * @author (your name) * @version (a version number or a date) */ public class player1 extends Actor { /** * Act - do whatever the player1 wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { if (Greenfoot.isKeyDown("left") ) { turn(-4); } move(4); } }
Morran Morran

2012/2/28

#
What are you trying to do? Do you want the player to be able to turn in both directions, do you want the player to come to a stop when turning, do you want the player to only move sometimes? What do you want to do, and what exactly is your problem?
davmac davmac

2012/2/29

#
This won't work what I am doing wrong?
For starters, your indentation is terrible... use "auto-layout" from the "edit" menu in the editor!
You need to login to post a reply.