Wednesday, 18 February 2015

Crab game - week 2

This week we learnt how to input key control into greenfoot, which can be used via the (Greenfoot.isKeyDown("left")); string or just move(); changing various variables can make you change the direction, and how fast/far the object you are controlling goes.

Greenfoot in general is a finicky program, and code strings are caps sensitive. simply typing iskeydown will result in a syntax error, so be careful when typing out new code.

Creating a new world/actor class is as simple as right clicking on the respective hub class and selecting new subclass. you can set a picture and name it in the pop up window. Not much else to say on this.

Other important strings
Greenfoot.getRandomNumber() - generate a random number between 0 and the number in brackets.
super(560, 560, 1); - this creates the size of the world, and how big the pixels in it are.

Personally, I'm enjoying this so far. the code is similar to VB so its relatively easy to pick up for me, so thankfully I'm not super far behind due to multiple technical difficulties and various at home problems. I'm excited for more next week.

No comments:

Post a Comment