Presentation is loading. Please wait.

Presentation is loading. Please wait.

Version 2.

Similar presentations


Presentation on theme: "Version 2."— Presentation transcript:

1 Version 2

2 Skills required from the exam
Create a new Greenfoot world Populate a given world with one or more objects Edit the objects so that they turn and move randomly Edit the program code to make the objects move in the direction of the arrow keys when pressed Edit the objects to detect object collision and remove these objects from the world Add a sound which will play when objects requires it to Add objects which can receive messages from other objects Edit objects so that they can change the image/value displayed on the Greenfoot world Save completed worlds as file names stated.

3 Populate a given world with one or more objects
Scenario > New Java Scenario Right click on Actor Class and add new subclass Choose an item and name it. Right click on the new subclass item and add to world (stage) holding shift allows for multiples items. Right click on stage and Save The World (Note – the editor will briefly open at this point – close it)

4 Edit objects so that they turn and move randomly
Right click on the item and open editor Add code to move 4 steps Compile and close editor Run to see your new act ‘method’ work Re-open editor and add an isAtEdge if method to turn

5 Edit objects so that they turn and move randomly
Edit the turn command to move a random angle To add a like-like ‘wobble’ movement to the object. Add a second if statement that asks if the random number (from 1-100) is less than 10… (i.e it has a 1/10 chance)… It will then turn 10 Test and then amend to turn a random number

6 Make objects move in the direction of the arrow keys
Add another object to the stage (this example creates a new Actor subclass called Player) Open it’s editor Add code that will allow it to continually move 4 steps and turn 3 degrees left and right (back)

7 Make objects move in the direction of the arrow keys
Develop code to allow more control

8 Detect object collision and remove these objects from the world
Open the editor for the Player object and add: New ‘invisible’ actor eat created for the purposes of this method Basically means is touching (intersecting with…) … the Food Actor If this is actually happening (not nothing) Remove the item from the world

9 Add a sound which will play when required to
Add into the eat IF statement the Greenfoot command to play a sound and specify the exact file name. (that should be stored in the project sounds folder.)

10 Adding a score counter (messages from other objects and changing values)
Edit > Import Class > Import Counter Edit the MyWorld class to allow the counter to be accessed by all world objects (This example creates a new counter called counter and a new method called getCounter which adds the counter to an x,y position and then returns the counter to other objects) Looking inside the counter class code you will see the existing method add (to increment the score) We will now instruct the player to ‘get’ the counter and use it’s add method

11 Adding a score counter (messages from other objects and changing values)
In the Player eat IF statement, add the following. This basically allows the Player to get the Myworld world and it’s counter then run the add method (by 1)

12 2014 Exam Open the WJECCrabs scenario in Greenfoot.
Populate the world with a crab and some wombats. Edit the wombat so that it turns and moves randomly. Edit the program code to make the crab move in the direction of the arrow keys when pressed. Edit the crab so that it “eats” a wombat (removes the wombat from the world) if they collide. Add a sound which will play every time a crab “eats” a wombat. Add a counter and edit the crab’s code so that the counter displays how many wombats the crab has “eaten”. Save your completed world as FinalWJECCrabs

13 2015 Exam Open the WJECIceBreaker scenario in Greenfoot.
Populate the world with a Ship (Icebreaker) and some Icebergs. Edit the Icebergs so that they turn and move randomly. Edit the program code to make the Ship move in the direction of the arrow keys when pressed. Edit the Ship so that it “breaks” an Iceberg when they collide (removes the Iceberg from the world). Add a sound which will play every time the Ship collides with an Iceberg. Add a counter and edit the Ship’s code so that the counter displays how many Icebergs have been broken (removed from the world). Save your completed world as FinaIIceBreaker

14 2016 Exam Open the WJECChase scenario in Greenfoot.
Populate the world with a cat, a mouse hole and at least two mouse objects. Edit the mouse so that mice turn and move randomly. Edit the program code to make the cat move in the direction of the arrow keys when pressed. Edit the cat so that it “catches” a mouse when they collide (removes the mouse from the world). Add a sound which will play every time the cat “catches” a mouse. Add a counter and edit the cat code so that the counter displays how many mice have been caught. Edit the mouse so that it “escapes” from the world if it collides with the mouse hole (removes the mouse from the world). Edit the mouse code and the counter code if necessary so that the counter loses a point (1 point is deducted) if the mouse “escapes”. Save your completed world as FinalWJECChase

15 From Spec Paper 1 Open the Wombats scenario in Greenfoot.
Populate the world with a wombat and some leaves. Check that the scenario is working. Edit the program code to make the wombats turn when the left or right cursor (arrow) keys are pressed so they can move back off the edge of the world. Add a sound which will play every time a wombat eats a leaf. Add a stationary predator to your world which will eat the wombat if they touch and end the game. Add a counter to display how many leaves the wombat has eaten. Save your completed world as Wombatswjec.

16 From Spec Paper 2 (2016 spec) Populate the world with an athlete, at least two water traps and at least two gates. Edit the gates and water traps so that they turn and move randomly. Edit the program code to make the athlete move at an appropriate speed in the direction of the arrow keys when pressed. Edit the athlete so that it “jumps” a gate when they collide (removes the gate from the world). Add a sound which will play every time the athlete “jumps” a gate. Add a counter and edit the code so that the counter displays how many gates have been “jumped”. Edit the code so that the counter loses a point (1 point is deducted) if the athlete collides with a water trap. Save your completed world as FinalTrain8

17 Youtube Links Leigh Quince (covers almost all WJEC skills)
Daniel Sydes (rushed, but covers all WJEC skills) Mr Gauvain (covers WJEC skills and beyond – links hard to follow) Michael Kölling (Slow but clear explanation of many skills) Jim Stewart (Lots of simpler tutorials) Kevin Rowan (Lots of advanced tutorials) Oracle Academy – (wordy – mostly text based)


Download ppt "Version 2."

Similar presentations


Ads by Google