• Bruce

Let's create a deadly MPAGD Acid Drop

Updated: Dec 5, 2021

Another request from the MPAGD Facebook group a tutorial that covers "the old faithful dripping water / acid that kills on contact?"


There's a number of approaches you can take to achieve an acid drop, I quite like this one, it's a little expensive bytewise since it uses quite a few sprite frames, but you could adapt it with less frames and then alter the timings. But I think this looks pretty nice:





First we need to create a sprite, the sprite animation falls into three parts:


1) The drip grows on the ceiling

2) The drip drops to the ground

3) The drop splashes on the floor


Here's my sprite:


Sequence 1 - the drip grows on the ceiling:








Sequence 2 - The drip drops to the ground


Sequence 3 - The drop splashes on the floor











So, were just going to use a single, multi-frame sprite and then write some code that will handle what should happen during each sequence. We won't use the ANIMATE command, instead we will use a timer variable and increment the frame number in the code at the right times.


Then, after a drop has hit the ground and the splash sequence has completed, we will reset the Y value of the drop, reset the frame to zero...and start all over again.


We'll use the DIRECTION sprite variable to control the sequences

We'll use SETTINGA as a timer variable

and we'll store the initial y value of the Sprite in SETTINGB so that we can restart after the acid drop splashes on the floor and so a new drop grows on the ceiling


Here's the code to (acid) drop into your sprite event:



Option: Increase the speed of the drop

If you've read my Deep Dive into the JUMP command in the beginners guide, you'll be aware that we can alter the speed of a jump or fall through the air. This is achieved using the sprite's JUMPSPEED variable. To increase the speed of the fall, simply increase Jumpspeed


For example, you could add this to the DROP ACID! routine....



IF DIRECTION = 2            ; DROP ACID!
   IF CANGODOWN             ; if we haven't hit the ground 
      FALL                  ; drop down 
      ADD 5 TO JUMPSPEED    ; increase the speed of the fall
   ELSE                     ; if we've hit the ground
      LET DIRECTION = 3     ; start the HIT THE GROUND routine
      ADD 1 TO FRAME        ; but increment the frame first
   ENDIF
ENDIF


OPTION: Create a pattern for the drops


If you want to get even more clever, you could alter the speed with which the drops grow on the ceiling and the speed of the fall by using a couple of variables and READ them in from a DATA statement, this way the drops would work on a pattern rather than always growing and falling at the same speed each time.



185 views0 comments

Recent Posts

See All

Want to support my work?....Buy my games!

aboutME

Hello, I'm Bruce and I write games for old 8bit computers using Jonathan Cauldwell's excellent Multi-Platform Arcade Games Designer (MPAGD)

I've written a few successful* games for the Sinclair ZX Spectrum and MSX platforms that have been (largely) well received with my most recent game - Twenty Four Hour Parsley People scoring a 10 out of 10 on Planeta Sinclair.

In my blog I am sharing lots of the code that I wrote for my games, in a way that you can use in your own games.   I've commented it so that you'll learn some of the techniques I use to create interesting new mechanics and help your games stand out from the pack.

MPAGD includes lots of standard scripts, they're great to get you started, but if you're new (or just rusty) when it comes to writing code, hopefully my tutorials will help you get started and  turn your imagination into awesome 8 bit games!

All my code is free to use and do with as you please, but if you find them useful please feel free to buy me a coffee ...or better still - buy or download my games :)

*successful is a very relative term in 8bit computer games