Game Development Reference
In-Depth Information
Find a Luigi sprite sheet. Most of these sheets come in sets for a single game. So if you found
a Mario sprite sheet, the Luigi version shouldn't be far off. You can also use the sprite sheet
that comes with this project.
1. First, make a copy of the
kart1
sprite to easily get a second kart sprite with
all of the scripts atached.
2. Instead of following the
player1
sprite, this sprite has to follow
player2
(using
go to <player2>
).
3. We also need to change the
key pressed
controls from
a
/
d
to
left
/
right
.
4. The hard work comes with changing the costumes. We need to follow the
same procedure we used earlier to create a series of Luigi sprites. Replace all
of the Mario costumes with the equivalent Luigi costumes.
5. Once we're done with the images, we can check the animaion with the small
test script that loops through all of the costumes.
6.
Make the necessary changes, if needed.
Objective complete - mini debriefing
We now have two player characters that are controlled with different keys. You should grab
a friend now and test the game together. Just adding another player to play the game with
adds a lot of fun to the acivity, even though we haven't scripted a way to clearly win the
game yet.
Classified intel
We could leave it at that; but, ater driving a few rounds together, you'll noice that both
the racers are able to pass through each other. This looks somewhat unrealisic; however,
we can fix it easily. We are going to add a collision check. When a player hits his/her
compeitor, he/she will bounce back, just like when hiing a wall.
1.
Check the script of control sprite
player1
. Take note of the part where we check
for collisions with walls.
2.
Pull the
touching color <green>?
block out of the slot and set it aside.
3.
Instead, place an
or
operator block in the slot of the
if () then
condiion.
4.
Replace the
touching color <green>?
block to the left of the
or
block.