making my first video game
Dave Cragg
dcragg at lacscentre.co.uk
Mon Jul 4 12:00:38 EDT 2005
On 4 Jul 2005, at 15:37, Nicolas Cueto wrote:
> Derek Bump offered:
>
>
>> That's a lot of script to process. Say 1 ship, 1 to 50 shots, 10
>> Alien
>> Crafts and don't
>> forget the powerups, upgrades and scrolling background.
>>
>
> Oh, I'm not aiming to make a space invaders game. What
> I'm after is a space invaders-like feature, namely, multiple
> shots. And only 1 to 10 shots, 5 Alien crafts (actually,
> phonemes falling from the sky), and no powerups, upgrades
> nor scrolling background. That'd be way over my meager
> scripting abilities!
Hi Nicolas
I've seen this done, and in fact I've converted an old Hyprcard stack
to Rev with exactly this kind of activity. It was a lot of fun.
Unfortunately, it was in a commercial product so I can't just pass
over the stack.
But here's the gist of one way to do it. (Very simple example) In
this case, there were 5 falling targets, each with a letter. A word
was spoken, and the user tries to hit the target with the
corresponding letter by moving left and right controls, and pressing
the "fire" button when aligned with the target. In this activity, if
the wrong target was hit, the missile just passed through the target.
(This may not be exciting enough, but I'll leave that to you.) Also,
there is no stream of missiles, just one at a time.
Naturally, the most important thing is the coolness of the sound when
you fire the missile. (Something like "pshwooooo")
on fireMissile
## the "target" image is determined elsewhere
put the cTargetImage of this card into tTarget
## first work out the left and right edges of the target
put the left of image tTarget into tL
put the right of image tTarget into tR
##play your cool sound
## it's good if it plays as soon as the button is clicked
play audioclip "missile"
## set the starting position of the missile
set the loc of image "missile" to the loc of image "spaceShip"
show image "missile"
##determine whether it's a hit or not before you even move the missile
## and determine where you want your missile to disappear if it's a miss
put item 1 of the loc of image "missile" into Xloc
if xLoc >= tL and xLoc <= tR then ##hit
put true into tHit
put the loc of image tTarget into tDestLoc
put xLoc into item 1 of tDestLoc
else
put false into tHit
put xLoc & ",20" into tDestLoc
end if
set the moveSpeed to 600
move image "missile" to tDestLoc
hide image "missile"
if tHit then
hide image tTarget
play audioclip "destruct"
wait until the sound is done
end if
end fireMissile
Cheers
Dave
More information about the use-livecode
mailing list