Hello England
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 9746
- Joined: Fri Feb 19, 2010 10:17 am
Hello England
There is a 'mag' pumped out by the Raspberry Pi foundation (had 2 'things' published in it a while ago)
aimed at English Primary School teachers (and which, if one turns one's filters on, can yield some useful things)
and their latest offering is this:
-
https://helloworld.raspberrypi.org/book ... ng_content
-
Which is available as a free download . . .
and, on page 71 there is this:
- -
which is about as basic as things get (and, as such, might not be a bad idea to start things off with).
So, here's a blank as I would set it up for the 8-11 year old brigade:
- -
and I wish you all you wish yourself . . .
My "cut" will follow later.
aimed at English Primary School teachers (and which, if one turns one's filters on, can yield some useful things)
and their latest offering is this:
-
https://helloworld.raspberrypi.org/book ... ng_content
-
Which is available as a free download . . .
and, on page 71 there is this:
- -
which is about as basic as things get (and, as such, might not be a bad idea to start things off with).
So, here's a blank as I would set it up for the 8-11 year old brigade:
- -
and I wish you all you wish yourself . . .
My "cut" will follow later.
- Attachments
-
- HWxample1.livecode.zip
- Stack.
- (138.88 KiB) Downloaded 121 times
-
- Livecode Opensource Backer
- Posts: 9746
- Joined: Fri Feb 19, 2010 10:17 am
Re: Hello England
One of the things that 'ticks me off' about this is that I feel that
children will rapidly lose interest as both the movements of the 'falling stars'
and the 'basket' are random, so there is no game involved and no skill.
So, I would modify things a bit:
-
children will rapidly lose interest as both the movements of the 'falling stars'
and the 'basket' are random, so there is no game involved and no skill.
So, I would modify things a bit:
-
Re: Hello England
"If the start falls into the bowl"
-
- Livecode Opensource Backer
- Posts: 9746
- Joined: Fri Feb 19, 2010 10:17 am
Re: Hello England
Ha, Ha, ha: you made my day by pointing out my mistake."If the start falls into the bowl"
-
Re: Hello England
Oh! I wasn't picking at you, I thought this was a snippet from the publication that got past proofreaders.
-
- Livecode Opensource Backer
- Posts: 9746
- Joined: Fri Feb 19, 2010 10:17 am
Re: Hello England
The first step is to set up potential positions the 'star' (here it is a sweetie) can drop from.
AS the stack is 1000 points wide we can set up potential start positions at intervals of 50 points across
the top of the stack, BUT we do NOT want the sweetie dropping at either edge of the stack.
So we need to slice up the stack into equal slices of 50 points:
- -
To address these positions we need to have a random number somewhere between 1 and 19 and then do this:
then we can use POZ as the horizontal position of our sweetie.
- -
In our finished game we will make sure the sweetie's starting position is above the top of the stack window so it is not initially visible.
AS the stack is 1000 points wide we can set up potential start positions at intervals of 50 points across
the top of the stack, BUT we do NOT want the sweetie dropping at either edge of the stack.
So we need to slice up the stack into equal slices of 50 points:
- -
To address these positions we need to have a random number somewhere between 1 and 19 and then do this:
Code: Select all
put random(18) into RX
put RX * 50 into POZ
- -
In our finished game we will make sure the sweetie's starting position is above the top of the stack window so it is not initially visible.
Code: Select all
on mouseUp
put random(18) into RX
put RX * 50 into POZ
set the location of image "sweetie" to POZ, -100
end mouseUp
- Attachments
-
- HWxample2.livecode.zip
- Stack.
- (139.4 KiB) Downloaded 110 times
-
- Livecode Opensource Backer
- Posts: 9746
- Joined: Fri Feb 19, 2010 10:17 am
Re: Hello England
I have now removed those 19 lines that I put there just to show where the 'slices' are to be.
Now we can work on the script that will make the sweetie fall out of the sky:
- -
the line:
is there so there are intervals in which the bowl can be moved.
Now we can work on the script that will make the sweetie fall out of the sky:
- -
the line:
Code: Select all
wait 3 ticks
- Attachments
-
- HWxample3.livecode.zip
- Stack.
- (139.13 KiB) Downloaded 107 times
Last edited by richmond62 on Wed Oct 26, 2022 8:33 pm, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 9746
- Joined: Fri Feb 19, 2010 10:17 am
Re: Hello England
Well, that's a pity, because with a simple mistake like that I deserved to be picked on.Oh! I wasn't picking at you
-
- Livecode Opensource Backer
- Posts: 9746
- Joined: Fri Feb 19, 2010 10:17 am
Re: Hello England
Now we can work on the script that can shift the bowl left and right in an attempt to catch the falling sweetie.
- -
We will use the RIGHT and the LEFT arrow keys on our keyboards to make the bowl move.
in LiveCode we can detect if the LEFT arrow key has been pressed with:
and, if the RIGHT arrow key has been pressed with:
- -
We will use the RIGHT and the LEFT arrow keys on our keyboards to make the bowl move.
in LiveCode we can detect if the LEFT arrow key has been pressed with:
Code: Select all
on arrowKey "left"
Code: Select all
on arrowKey "right"
Last edited by richmond62 on Sat Oct 29, 2022 7:42 am, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 9746
- Joined: Fri Feb 19, 2010 10:17 am
Re: Hello England
You will see that we ask if an arrow key has been pressed once, and then we ask if it is the LEFT or the RIGHT key:
Code: Select all
on arrowKey AK
if AK is "right" then
put item 1 of the location of image "bowl" into LR
put item 2 of the location of image "bowl" into UD
set the location of image "bowl" to (LR + 25), UD
else
put item 1 of the location of image "bowl" into LR
put item 2 of the location of image "bowl" into UD
set the location of image "bowl" to (LR - 25), UD
end if
end arrowKey
- Attachments
-
- left & right.livecode.zip
- Stack.
- (11.33 KiB) Downloaded 123 times
-
- Livecode Opensource Backer
- Posts: 9746
- Joined: Fri Feb 19, 2010 10:17 am
Re: Hello England
Now we need to learn about intersect . . .
-
- Livecode Opensource Backer
- Posts: 9746
- Joined: Fri Feb 19, 2010 10:17 am
Re: Hello England
It is NOT a bad idea to STOP the bowl going away at either the left or the right edge of the stack window:
- -
- -
Code: Select all
on arrowKey AK
if AK is "right" then
put item 1 of the location of image "bowl" into LR
put item 2 of the location of image "bowl" into UD
if (LR + 25) < 1000 then
set the location of image "bowl" to (LR + 25), UD
end if
else
put item 1 of the location of image "bowl" into LR
put item 2 of the location of image "bowl" into UD
if (LR - 25) > 0 then
set the location of image "bowl" to (LR - 25), UD
end if
end if
end arrowKey
-
- Livecode Opensource Backer
- Posts: 9746
- Joined: Fri Feb 19, 2010 10:17 am
Re: Hello England
We must be careful to insert with messages after our wait command so the computer will pick up our arrow keys presses during the animation loop for the sweetie:
you will see how intersect comes into play to check whether the sweetie is ending up 'in' the owl.
Code: Select all
on mouseUp
put random(18) into RX
put RX * 50 into POZ
set the location of image "sweetie" to POZ, -100
put 5 into XXX
repeat until XXX > 860
put item 2 of the loc of image "sweetie" into UD
add 10 to UD
add 10 to XXX
set the location of image "sweetie" to POZ, UD
wait 2 ticks with messages
end repeat
if intersect(image "sweetie", image "bowl", 5) then
add 3 to field "fSCORE"
set the visible of image "WD" to true
wait 30 ticks
set the visible of image "WD" to false
send "mouseUp" to button "START"
else
set the visible of image "GO" to true
end if
set the location of image "sweetie" to POZ, -100
end mouseUp
-
- Livecode Opensource Backer
- Posts: 9746
- Joined: Fri Feb 19, 2010 10:17 am
Re: Hello England
As LiveCode is WYSIWYG it is always handy to have a tester around to try out your game,
and tell you what's wrong with it:
- -
My tester suggested some visual feedback, so we popped 2 images together almost 100% inwith LiveCode:
-
and tell you what's wrong with it:
- -
My tester suggested some visual feedback, so we popped 2 images together almost 100% inwith LiveCode:
-
-
- Livecode Opensource Backer
- Posts: 9746
- Joined: Fri Feb 19, 2010 10:17 am
Re: Hello England
My tester told me that, because the bowl and the sweetie were too large, the game was too easy,
so we resized both of them to half of their original sizes:
- -
The article cited states:
"It can sometimes be difficult to distinguish between the levels of coding/building and running the project,
as learners should be repeatedly cycling through coding and running, to check that their program is working."
LiveCode lends itself particularly well to cycling through coding and running.
so we resized both of them to half of their original sizes:
- -
The article cited states:
"It can sometimes be difficult to distinguish between the levels of coding/building and running the project,
as learners should be repeatedly cycling through coding and running, to check that their program is working."
LiveCode lends itself particularly well to cycling through coding and running.