Presentation is loading. Please wait.

Presentation is loading. Please wait.

WJEC GCSE Computer Science

Similar presentations


Presentation on theme: "WJEC GCSE Computer Science"— Presentation transcript:

1 WJEC GCSE Computer Science
Unit 2 Greenfoot

2 Learning Intentions and Outcomes
Use the Greenfoot programming environment to design, write, and test Java programs. Skills Checklist Adding new and existing Actors to the World Editing Actors to add methods (making them move!) Using the random number generation function Removing objects from the world (isTouching) Playing Sounds Adding a Counter and Score System

3 Opening an Existing Scenario

4 Adding to the World Adding Actors addObject(new actorname(), X, Y); e.g. addObject(new WaterDrop(), 1,1); Adding Counters Counter Score = new Counter(); addObject(Score, 0,0);

5 Moving Actors: Using Keys
Check if the button is down: if(Greenfoot.isKeyDown(“button”)) Add curly braces { } Set Rotation: Right = 0 Down = 90 Left = 180 Up = 270 setRotation(X); Move 1 move(1);

6 Moving Actors Randomly
Turn a random amount between 0 and 360 degrees turn(Greenfoot.getRandomNumber(360)); Move 1 move(1);

7 Making Actors Remove Inside the Actor you move
Check if it is touching: if(isTouching(actor.class)) { } Remove Touching removeTouching(actor.class);

8 Changing the Score Set up a Counter Variable Find the Counter
Counter Score = Find the Counter (Counter)getWorld().getObjects(Counter.class).get(0); On a new line.. Bump the Counter! Score.bumpCount(1); Score.bumpCount(-1);

9 Playing a Sound Right Click the Actor Open Editor Code
if (isTouching(Bee.class)) { removeTouching(Bee.class); Greenfoot.playSound(“file.wav”); }

10 Workbook Complete section 11


Download ppt "WJEC GCSE Computer Science"

Similar presentations


Ads by Google