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

2019/4/14

How do I make my character only move Left or Right?

secretbackupboss secretbackupboss

2019/4/14

#
Greetings, I am doing this project for my Computer Science Class and need help with this basic thing. How do I move my character left or right? I have already tried googleing this but all the topics seemed to be outdated and not exactly what I was looking for, any help will be helpful, thank you
danpost danpost

2019/4/14

#
How far did you get on your own? What codes have you tried? What do you think the code should look like?
secretbackupboss secretbackupboss

2019/4/14

#
Actually, I finally figured it out before this got approved. I just used this code to do it, in case anyone else finds this. public void act() { move (0); if (Greenfoot.isKeyDown("left")) { move(-3); } if (Greenfoot.isKeyDown("right")) { move(3); } }
Super_Hippo Super_Hippo

2019/4/14

#
This line is doing nothing at all:
move(0);
You need to login to post a reply.