In this tutorial GP concepts and words will be shown in bold, and Scratch concepts and words will be shown in italics
It is available for Windows,Mac and Linux from https://gpblocks.org/
There is also a version running on a web server so it can be tried out without having to install anything
The screen is different in layout to Scratch but has the same basic areas.
Top left are block categories – next is blocks within category – scripts go bottom left – the stage is on the right.
(GP draws a dotted line to sprites – just click show arrows at top right to switch this off)
Below the stage are the classes and instances – just don’t worry about these names for the moment and treat them as being same as sprites i.e if you want a new sprite – click on Classes +
(Instances + is like Scratch 2 cloning to create a copy of a sprite so just leave that alone for moment)
(If you do press Instances + by mistook, then you can easily get rid of them by pressing Clear button on the right)
There are only 2 inbuilt costumes – one called ship and another one called GP.
But you can load any .png type file by clicking on Images tab and selecting Add Images From File.
Instances only have one costume but you can modify it (or draw your own) using the blocks in the Drawing and Pixels categories
There is a simple example of building a little project here
Lets make a simple project in both Scratch and GP to count to 10
So main differences were:
When Green Flag click == when I receive go
There is no in GP so we always have to add in own own wait block
Now although we can write nearly the exactly same code in GP compared to Scratch, GP has far more programming tools so this is the actual way of doing this in GP |
These for loops are present in nearly all programming languages (Scratch being a notable exception) so they are well worth getting to know as it saves having to create a variable to keep track of the count and having to have a block to increase it inside of the loop.
Note: You can right-click on the and give it nice name if you want
TWO MAJOR DIFFERENCES BETWEEN Scratch AND GP
There is no in GP – it has been replaced by
Consider these two scripts
So in Scratch repeat until will loop until something becomes true but in GP the while will loop while something is true
So in Scratch we are looping until the count is bigger than 10, in GP we loop while the count less than 11
GP uses one combined if block instead of Scratch’s two types. It can be changed from if to if/else by simply clicking on the black arrow
GPs if/elseif block is much more powerful than the simple example above and can save a lot of nested if statements which leads to your code being easier to read and debug
GP has a lot in common with Scratch but some notable differences
The one thing that is the same is the Pen category that lets your draw over the screen just as in Scratch.
There is no actual Stage (Scratch 1.4) or Background (Scratch 2).
But you can easily simulate this by creating a class with a big costume (GP screen size is 800 x 500 unlike Scratch’s 480×360) and just don’t move it around.
GP only comes with 2 images (the Ship and the GP one) but you can load in any .png image and set the instances costume to it very easily.
Simon Walters has converted all the Scratch 1.4 images to .png and re-sized the background ones to be 800×500. The zipped file of these images is available here.
The timer counts up in milliiseconds (thousanths of seconds) and there is no reset timer block. So you have to set a variable, say starttime, to timer value and then subtract the timer from your starttime and divide it by 1000 to get the time difference in seconds.
There is no touching colour or touching edge. You can only detect touching a class or the mouse)