Here is some pseudo code i've produced for two projects while I was at college;
2D Platform game using Stencyl (3 person project)
Variables
Var Player
Var Player2
Var runningspeedleft:
number
= 10
Var
runningspeedright:number =10
Var Jumpingheight:number = 15
Var GoldCup
Var Score:number = 0
Var Health:number = 1
Var Enemy
Running
{
If
Right Key is down
Player.X > runningspeedright
}
{
If
Left Key is down
Player.X<runningspeedleft
}
Jumping
{
If
Up Key is down
Player.Y >Jumpingheight
}
Collisions
{
When Player collides
with GoldCup
Set Score + 100
RemoveChild(GoldCup);
Create Player2 at Player.X + Player.Y
Set Health =+1
}
{
When Player collides with Enemy
Set Health =-1
Set Score =-300
If Health = 0
Player.X = 0
Player.Y = 0
}
GUI
{
Print Score.txt at X =20 + Y = 20
Print Health.txt at X =20 + Y =30
}
IT Security Robot
For the IT project the pseudo code was initially produced and then shown to the client pending their approval. If the client was happy that the pseudo code met the requirements of their brief it would then be passed onto the coder who would implement it.
NXT Brick 1
(Message Sender Robot)
Run “Door Alarm”
Repeat Duration 10 Seconds
If Target is within 30 centimetres then
Status is “True”
Else Continue
running till Status is set to “True”
If Status set =
“True”
Run
Block
“Send Message”
Wait 10 seconds
Loop Duration “Unlimited”
NXT Brick 2
(Message Receiver Robot)
Run “Receiver”
If Logic is “True”
Run Receive Message
Run
Text “Alarm”
Run Sound
“Alarm”
Wait 10 seconds
Else Wait till Logic is “True”
No comments:
Post a Comment