[Thread Prev] [Thread Next]
This approach allows for easier sharing: you can simply email turtles.
That's almost all there is to it. Only the "game launcher" is in the public
procs tab.
IN THE PUBLIC PROCEDURES TAB:
to playgame
freezebg
attack1, clickon
pok1, clickon
end
INSIDE POK1's BACKPACK:
In the OnClick field, in Forever mode:
ReadKBD
IN THE PROC TAB OF THAT SAME BACKPACK
to ReadKBD
make "key readchar
if :key = "A [pok1, seth -90 fd 10]
if :key = "S [pok1, seth 180 fd 10]
if :key = "D [pok1, seth 90 fd 10]
if :key = "W [pok1, seth 0 fd 10]
if :key = "1 [launch [FightWithAttack1]]
if :key = "J [pok2, seth -90 fd 10]
if :key = "K [pok2, seth 180 fd 10]
if :key = "L [pok2, seth 90 fd 10]
if :key = "I [pok2, seth 0 fd 10]
if :key = "3 [launch [FightWithAttack2]
end
to FightWithAttack1
attack1, setpos pok1's "pos
seth pok1's "heading
st setsh 30 clickon wait 10 ht
to FightWithAttack2
attack2, setpos pok2's "pos
seth pok2's "heading
st setsh 32 clickon wait 10 ht
end
STILL IN POK1'S BACKPACK, RULES TAB, ONTOUCHING FIELD
STILL IN THE PROC TAB OF THAT BACKPACK
to react
make "contact touchedturtle
if or :contact = "attack1
:contact = "attack2
[attack1, rt 180 attack2, rt 180]
end
IN ATTACK2'S BACKPACK, RULES TAB, ONTOUCHING FIELD
React
IN ITS PROC TAB
To react
if touchedturtle = "pok1
[announce [pok1 you lose]]
end
and so on...
-----Original Message-----
From: mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
[mailto:mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Daniel Ajoy
Sent: June 27, 2007 8:01 PM
To: mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Cc: murdiales@xxxxxxxxxxxxxxxxxxxxx
Subject: students trying to share
hi forum,
Just today I learned that two students tried to share
this code to make to pokemons fight:
to playgame
freezebg
forever
[make "key readchar
if :key = "A [pok1, seth -90 fd 10]
if :key = "S [pok1, seth 180 fd 10]
if :key = "D [pok1, seth 90 fd 10]
if :key = "W [pok1, seth 0 fd 10]
if :key = "1 [
launch [
attack1, setpos pok1's "pos
seth pok1's "heading
st setsh 30 clickon wait 10 ht
]
]
if :key = "J [pok2, seth -90 fd 10]
if :key = "K [pok2, seth 180 fd 10]
if :key = "L [pok2, seth 90 fd 10]
if :key = "I [pok2, seth 0 fd 10]
if :key = "3 [
launch [
attack2, setpos pok2's "pos
seth pok2's "heading
st setsh 32 clickon wait 10 ht
]
]
if touching? "attack1 "attack2 [attack1, rt 180 attack2, rt 180]
if touching? "attack2 "pok1 [announce [pok1 you lose]]
if touching? "attack1 "pok2 [announce [pok2 you lose]]
end
The problem is that it doesn't work because the code is
incomplete. Extra code resides in turtles, that is
activated using clickon.
For the sharing processes to have worked, ALL the code
should have been in a single place, the procedures page.
But MW discourages that.
Daniel
Previous by thread:
students trying to share
Next by thread:
Lego NXT
To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.
|