Author [EN] [PL] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [ID] Topic: Incorporate that old-school feel into your fan games  (Read 18627 times)

0 Members and 1 Guest are viewing this topic.

Offline FeRcHuLeS

  • Hunter in Training
  • **
  • Posts: 85
  • Only at the Castle Gate...
  • Awards May 2017 Sprite Contest Third Place
    • Awards
  • Favorite Game: Castlevania: Symphony of the Night (PS1/SS)
  • Likes:
Re: Incorporate that old-school feel into your fan games
« Reply #15 on: May 18, 2016, 09:01:53 PM »
0
You mean MSX's version? Not sure about that. I haven't played the MSX version and don't have an MSX emulator. Watching longplay videos, it's hard for me to say. for the most part, the game design appears very close for most enemies with minor differences.

Sorry for the late reply, I was so busy these days about Vampire Killer yeah I meant the MSX2's, thanx for the single heart you shared I don't know how to express myself, the thing is I'm not used to programming so Could you point me out, please! where is the code for the animation only? because I read something like "sound" and "alarms" that confuses me, I'll try to run it using the devkitSMS in C, It is the first time I try moving sprites by itself and if I succeed then I'll try to make the same with the water splash.

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: Incorporate that old-school feel into your fan games
« Reply #16 on: May 18, 2016, 10:43:04 PM »
0
The small heart sprite isn't animated. The motion of the heart is determined by hspd (horizontal vector) and vspd (vertical vector). For something as simple as item drops, you can skip the status |= lines, even if you decide to actually use the control system.

if timeline_position > 2 The heart can't be grabbed until state 3
{
    if abs(x - Belmont.x) < 12 When the player is within range of the heart...
    if abs(y - Belmont.y) < 20
    {
        play_sound(snd_19); Play the "heart acquired" sound effect
        subHearts +=  1; Increase the number of hearts
        timeline_position   =   5; Jump to the last state
    }
}

switch timeline_position
{
    case 0:
        status |= STILL;
        sprite_index = spr_SmallHeart; Set the sprite of the heart
        timeline_position+=1 Go to next state
        break;
       
    case 1:
        status |= MOVING;
        vspd = 1/4; Set the vertical speed to 1/4
        timeline_position+=1;
        break;
       
    case 2:
        timeline_position+=1
        alarm[3]    =   0; This determines the left/right direction
        alarm[2]    =   1; This is a timer
        break;
       
    case 3:
        alarm[2]    -=  1; Count down the timer
        if !alarm[2] Check if the timer reached 0
        {
            alarm[3]    ^=  1; Change directions
            hspeed      =   -alarm[3] | 1; Set the horizontal speed
            alarm[2]    =   $38; Reset the timer
        }
       
        Add horizontal air resistance to the heart
        if alarm[3]
            hspeed  +=  1/32;
        else
            hspeed  -=  1/32;
       
        If the heart leaves the screen, destroy it
        if x < view_xview+4
            instance_destroy();
        else
        if x > view_xview+$FB
            instance_destroy();
        else
        if y < view_yview+8
            instance_destroy();
        else
        if y > view_yview+$D7
            instance_destroy();
           
        If the heart touches the ground, stop it
        if tile_map_read($0E,1) //check for collision below
        {
            vspeed      =   0;
            hspeed      =   0;
            timeline_position   +=  1;
        }
        break;
       
    case 4:
        alarm[2] -= 1; Count down to when the heart finally vanishes
        if !alarm[02]
            timeline_position += 1;
        break;
       
    case 5:
        instance_destroy();
        break;
}


I just realized I left out the final timer value for how long to sit on the ground. I want to say it's $78, but I'm probably wrong. I'll have to look it up again later.
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline FeRcHuLeS

  • Hunter in Training
  • **
  • Posts: 85
  • Only at the Castle Gate...
  • Awards May 2017 Sprite Contest Third Place
    • Awards
  • Favorite Game: Castlevania: Symphony of the Night (PS1/SS)
  • Likes:
Re: Incorporate that old-school feel into your fan games
« Reply #17 on: May 20, 2016, 08:44:16 AM »
0
I tried to run the single heart code by hand and got stuck here:

Code: [Select]

case 3:
        alarm[2]    -=  1; Count down the timer
        if !alarm[2] Check if the timer reached 0
        {
            alarm[3]    ^=  1; Change directions


alarm[3] is never going to change the direction the value is always 1 unles a "|" is used instead of "^", I tried to add the horizontal air resistance without success, do you mind giving me a hand? in order to add the horizontal air resistance, this is the code in devkitSMS I made:

Code: [Select]
#include "SMSlib.h"   // we're including the library with the functions we will use
#include "assets.h"   // we're including the assets we created before

#define    DIR_SE           1
#define    DIR_SW          2
#define    STOPIT          3

#define    HEART_SPEED_NORM_X    (unsigned int)((1<<8)/2)   //hspd 1/2
#define    HEART_SPEED_NORM_Y    (unsigned int)((1<<8)/4)   //vspd 1/4

#define    HEART_W     8     //heart width
#define    HEART_H      8     //heart height

#define    LEFT_LIMIT        (200-32)
#define    RIGHT_LIMIT       (200)
#define    BOTTOM_LIMIT    (192-24)

#define    SPRITE_TILES     256                                 
#define    HEART_TILES      (SPRITE_TILES+72)                  //single heart


unsigned int HeartDir, HeartX, HeartY;

void initGame (void) {

  HeartX=((200-16)<<8);     //original position in X
  HeartY=(50)<<8;      //original position in Y
  HeartDir=DIR_SW;
}

void moveHeart (void) {
  switch (HeartDir) {

    case DIR_SE:HeartX+=HEART_SPEED_NORM_X; HeartY+=HEART_SPEED_NORM_Y; break;   
    //direction SE
    case DIR_SW:HeartX-=HEART_SPEED_NORM_X; HeartY+=HEART_SPEED_NORM_Y; break; 
    //direction SW
    case STOPIT: break;

  }

  if (((HeartY/256)+HEART_H)==BOTTOM_LIMIT) {
    HeartDir=STOPIT;
    // bottom limit collisions
  }

  if (((HeartX/256)-HEART_W)<LEFT_LIMIT) {
    // left limit collisions
    if (HeartDir==DIR_SW) HeartDir=DIR_SE;
  }
  if (((HeartX/256)+HEART_W)>RIGHT_LIMIT) {
    // right limit collisions
    if (HeartDir==DIR_SE) HeartDir=DIR_SW;
  }
 
}

void drawHeart (void) {
  SMS_addSprite((HeartX>>8)-(HEART_W/2), (HeartY>>8)-(HEART_H/2), HEART_TILES);
  // (x,y,tile)
}

void main (void) {
  SMS_setSpriteMode (SPRITEMODE_NORMAL);
  loadAssets();
  initGame();
  SMS_displayOn();
  for (;;) {
    moveHeart();
    SMS_initSprites();
    drawHeart();
    SMS_finalizeSprites();
    SMS_waitForVBlank();
    SMS_copySpritestoSAT();
  }
}
« Last Edit: May 23, 2016, 06:42:48 PM by FeRcHuLeS »

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: Incorporate that old-school feel into your fan games
« Reply #18 on: May 20, 2016, 08:48:36 PM »
0
Make sure alarm 3 starts at zero. And the carat is for bitwise xor. As long as alarm 3 is defaulted to zero when the heart is created, then xor 1 will always toggle it.
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: Incorporate that old-school feel into your fan games
« Reply #19 on: May 22, 2016, 09:32:01 PM »
0
I'll probably post more tonight... maybe... But just a heads up for anyone hoping for CV3 boss code:

I haven't delved very far into CV3 boss codes at all. I started on Dracula, the Vampire Bat, Cyclops, and Death; however, bosses were coded by someone other than whoever coded the enemies and Trevor. I'm thinking it was Kitamoto, possibly Okuda; I strongly doubt Akamatsu programmed the bosses, because the rest of the code seems to follow a particular direction (and he was the director).

So, even though I have half of Death's code done, I don't expect to have any of the boss codes properly translated any time in the near future. For now, you'll have to settle on whatever I actually get uploaded to her.
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
My fish has a fungal infection!
« Reply #20 on: May 27, 2016, 01:40:36 AM »
0
UPDATE: The mermen and many other enemies as reflected in my code are assumed to use a custom sprite animation code. If you want to use the built-in functionality of frontends like Game Maker, you'll need to use multiple sprites. Any time a code sets the image_index and either sets image_speed to 0 or status |= STILL, you can include those frames of the animation in one combined sprite; but any time the code sets image_speed to some value other than 0 and status &= ~STILL, you'll need a separate sprite just for that animation. I'm aware that me using the built-in variables image_speed and image_index makes that so confusing, but I wasn't thinking about GM's mechanics at the time of writing all of this.



Merman (Ambush)
timeline_index = st_merjump
These are the ones closer to the original Castlevania Merman that just jump out of the water without warning, spit a couple times, then jump back down. This is not the Merman that appears in the flooded rooms of the sunken city.
EDIT: Fixed an error with timeline_position 12 and 23 - I was too hasty writing it originally and left out a large chunk of the code. There is no typo here - if the break points aren't encountered, cases 12 and 23 run on into case 9.
Code: [Select]
switch timeline_position
{
    case 0:
        swimmer = 0; //my own addition
        var temp;
        status |= STILL;
        switch (!!global.block + global.hard_mode << 3) + (system.alarm[0] + x & $7) //not a typo
        {
            case 0:
            case 2:
                temp = $68;
                break;
               
            case 1:
            case 11:
                temp = $A0;
                break;
               
            case 3:
                temp = $88;
                break;
               
            case 4:
                temp = $98;
                break;
               
            case 5:
                temp = $78;
                break;
               
            case 6:
                temp = $90;
                break;
               
            case 7:
                temp = $70;
                break;
               
            case 8:
                temp = $58;
                break;
               
            case 9:
                temp = $4C;
                break;
               
            case 10:
                temp = $48;
                break;
               
            case 12:
                temp = $5C;
                break;
               
            case 13:
                temp = $60;
                break;
               
            case 14:
            case 22:
                temp = $C0;
                break;
               
            case 15:
                temp = $50;
                break;
               
            case 16:
                temp = $30;
                break;
               
            case 17:
                temp = $D8;
                break;
               
            case 18:
            case 20:
                temp = $38;
                break;
               
            case 19:
                temp = $40;
                break;
               
            case 21:
                temp = $44;
                break;
               
            case 23:
                temp = $2C;
                break;
        }
        x = (Belmont.x - view_xview + temp & $FF) + view_xview;
        timeline_position += 1;
        break;
       
    case 1:
    case 13:
    case 24:
        en_xscale_set();
        timeline_position += 1;
        break;
       
    case 2:
        sprite_index = spr_Merman;
        image_speed = 0;
        image_index = 5; //looking up
        status |= STILL;
        timeline_position += 1;
        break;
       
    case 3:
    case 33:
        status |= MOVING;
        timeline_position += 1;
        break;
       
    case 4:
        timeline_position += 1;
        play_sound(snd_20); //play splash sfx
        break;
       
    case 5:
        timeline_position += 1;
        vspd = -7;
        alarm[2] = $2C;
        break;
       
    case 6:
        vspd += alarm[2]/$100;
        if vspd<0 exit;
        if vspd>=3
            if y-view_yview > $AF
            {
                if swimmer
                {
                    timeline_position = $35;
                    spawn_splash(0,-$18);
                }
                else
                    timeline_position = 0;
                exit;
            }
        if !tile_map_read($6,image_xscale) exit; //check for collision below
        timeline_position += 1;
        y &= ~$F;
        vspd = 0;
        break;
       
    case 7:
        image_index = 3; //looking down
        status |= STILL;
        timeline_position += 1;
        break;
       
    case 8:
        alarm[2] = 6;
        timeline_position += 1;
        break;
       
    case 12:
    case 23:
        if !tile_map_read($D,0) //($0,$10)
        {
            move_stop();
            move_vert_set(1,0);
            timeline_position = 37;
            break;
        }
        else
        if tile_map_read(5,image_xscale)
        {
            move_horz_rev(1);
            break;
        else
        if tile_map_read(0,image_xscale)
        {
            move_horz_rev(1);
            break;
        }   
    case 9:
    case 17:
    case 20:
    case 28:
    case 31:
        alarm[2] -= 1;
        if !alarm[2]
            timeline_position += 1;
        break;
       
    case 10:
    case 21:
        timeline_position += 1;
        status &= ~STILL;
        status |= MOVING;
        image_index = 0; //2 frame cycle
        image_speed = 1/$10;
        en_xscale_set();
        hspd = 7/16 * image_xscale;
        break;
       
    case 11:
    case 22:
        alarm[2] = $90;
        timeline_position += 1;
        break;
       
    case 14:
    case 25:
        status &= ~MOVING;
        status |= STILL;
        timeline_position += 1;
        break;
       
    case 15:
    case 26:
        image_index = 2; //open mouth
        timeline_position += 1;
        break;
       
    case 16:
    case 19:
    case 27:
    case 30:
        alarm[2] = $18;
        timeline_position += 1;
        break;
       
    case 18:
    case 29:
        timeline_position += 1;
        if status & (HIDDEN|OFFSCREEN) exit;
        play_sound(snd_31);
        spawn_fireball(3,-9); //create a fireball at (3,-9) relative to xscale
        break;
       
    case 32:
        timeline_position += 1;
        vspd = -1;
        break;
       
    case 34:
        vspd += 1/8;
        if swimmer
        {
            if y-view_yview > $BF-$10*(stage==8) //Sunken City had higher water
            {
                timeline_position += 1;
                spawn_splash(0,-$18);
            }
        }
        else
        if y-view_yview > $F7
            timeline_position += 1;
            //junk code - controller destroys anything below $F8 anyway
        break;
       
    case 35:
        timeline_position += 1;
        play_sound(snd_21); //play sploosh sfx
        break;
       
    case 36:
        instance_destroy();
        break;
       
}


Merman (Swimming)
timeline_index = st_merswim
Similar to previous Merman, but swims in rather than just appearing suddenly.
Code: [Select]
switch timeline_position
{
    case 0:
        swimmer = 1; //my own addition
        if tile_map_read($17,0) //make sure not spawning in ground
            enemy_destroy();
        timeline_position += 1;
        break;
   
    case 1:
        alarm[2] = $10;
        sprite_index = spr_FishShadow.gif;
        image_speed = 1/12;
        image_index = 6;
        status &= ~STILL;
        timeline_position += 1;
        break;
       
    case 2:
        status |= MOVING;
        en_xscale_set();
        hspd = 3/2 * image_xscale;
        timeline_position += 1;
        break;
       
    case 3:
        timeline_position += 1;
        alarm[2] = abs(x-Belmont.x)<$40;
        break;
       
    case 4:
        if system.alarm[0] & 1 //originally ! but this is faster
            status ^= FLICKER; //flicker effect
        if abs(x-Belmont.x) < $40
            if alarm[2]
            {
                if x < Belmont.x
                    timeline_position += 1;
            }
            else
                if x >= Belmont.x
                    timeline_position += 1;
        break;
   
    case 5:
        status &= ~FLICKER;
        timeline_position += 1;
        break;
       
    case 6:
        status &= ~MOVING; //a move_stop would have been better
        timeline_position += 1;
        break;
       
    case 7:
    case 20:
        en_xscale_set();
        timeline_position += 1;
        break;
       
    case 8:
        sprite_index = spr_Merman;
        image_index = 5;
        status |= STILL;
        timeline_position += 1;
        break;
       
    case 9:
        status |= MOVING;
        timeline_position += 1;
        break;
       
    case 10:
        play_sound(snd_20); //play splash sfx
        timeline_position += 1;
        break;
       
    case 11:
        timeline_position += 1;
        hspd = 0;
        vspd = -6;
        alarm[2] = $24;
        break;
       
    case 12:
        spawn_splash(0,-$18);
        timeline_index = st_merjump;
        timeline_position = 6;
        break;
}


Merman (Floating)
timeline_index = st_merfloat
The ones that you see in the aqueducts.
Code: [Select]
switch timeline_position
{
    case 0:
        if tile_map_read($17,0) //make sure not spawned in ground
            instance_destroy();
        else
        timeline_position += 1;
        break;
       
    case 1:
        sprite_index = spr_FishShadow;
        image_index = 6;
        image_speed = 1/12;
        status &= !STILL;
        timeline_position += 1;
        break;
       
    case 2:
        timeline_position += 1;
        en_xscale_set();
        status |= MOVING;
        hspd = 9/8 * image_xscale;
        break;
       
    case 3:
        alarm[3] = $60;
        timeline_position += 1;
        vspd = -1/16;
        alarm[2] = y;
        break;
       
    case 4:
        alarm[3] -= 1;
        if !alarm[3]
        {
            timeline_position += 1;
            exit;
        }
        move_sinewave();
        if !tile_map_read($A,image_xscale) //check if dropping down waterfall
        {
            move_stop();
            hspd = 1 * image_xscale;
            timeline_position = $16;
        }
        break;
       
    case 5:
        timeline_position += 1;
        status &= ~MOVING;
        break;
       
    case 6:
        en_xscale_set();
        timeline_position += 1;
        break;
       
    case 7:
        y -= 8; //because the shadow is at the top of the sprite
        timeline_position += 1;
        break;
       
    case 8:
        timeline_position += 1;
        status |= STILL;
        break;
       
    case 9:
        image_index = 0;
        timeline_position += 1;
        break;
       
    case 10:
        timeline_position += 1;
        play_sound(snd_20); //play splash effect
        break;
       
    case 11:
        timeline_position += 1;
        spawn_splash(0,-$18);
        break;
       
    case 12:
    case 18:
        timeline_position += 1;
        alarm[2] = $18;
        break;
       
    case 13:
    case 16:
    case 19:
        alarm[2] -= 1;
        if !alarm[2]
            timeline_position += 1;
        break;
       
    case 14:
        image_index = 2;
        timeline_position += 1;
        break;
       
    case 15:
        alarm[2] = $10;
        timeline_position += 1;
        break;
       
    case 17:
        if status & (HIDDEN|OFFSCREEN) exit;
        sound_play(snd_31);
        spawn_fireball(8,-9);
        timeline_position += 1;
        break;
       
    case 20:
        y += 8;
        timeline_position += 1;
        break;
       
    case 21:
        timeline_position = 1;
        break;
       
    case 22:
        vspd += 5/64;
        if tile_map_read($A,image_xscale)
            timeline_position = 1;
        break;
}

The Merman in the sunken city is essentially the same as the regular Merman, except for a few things:
  • Spawn height and splash height (when the effect is created and sound is played) is based on the current height of the water.
  • Only one fireball is spat.
  • The tile map collision is garbage due to a bad typo and poor planning.
    • The terrain never changes as the water rises, so where it appears there is water, it could still be solid ground and so the Merman can't spawn.
    • Konami's collision code had basically 2 arguments - the horizontal offset and vertical offset from the instance's coordinates to check for a tile collision. Instead of passing the offsets, they passed the coordinates themselves. This had 3 ramifications:
      • A merman could fail to spawn because the collision check was done on a solid nowhere near the merman.
      • A merman could spawn inside a solid tile (graphical glitch) because the collision check was done on an empty tile nowhere near the merman.
      • Mermen will cease spawning temporarily because the collision check will eventually fall outside the spawn zone (e.g., too low on the screen) once the flood level has reached a certain height.

UPDATE #2: Here's my transliteration of the flood-zone Merman.

Flood Merman
timeline_index = st_floodman
The variable global.floodzone holds the height of the water on the screen, so it's a value between $FF and $30 (counting down, obviously).
Code: [Select]
switch timeline_position
{
case 0:
    timeline_position += 1;
    var temp;
    //Can probably do without abs() below, since Belmont should drown,
    //but it is possible for the water to go above Belmont's origin.
    temp = median(abs(global.floodzone - Belmont.y) - $28 >> 4,0,4);
    switch temp
    {
        case 0: vspd = -15/4; break;
        case 1: vspd = -17/4; break;
        case 2: vspd = -9/2; break;
        case 3: vspd = -19/4; break;
        case 4: vspd = -11/2; break;
    }
   
    //check for ground collision
    if tile_map_read( , ) //check for collision at (x+x,y+y) w/screen wrapping
        enemy_destroy();
    else
    {
        play_sound(snd_20);
        status |= MOVING | STILL;
        sprite_index = spr_Merman;
        image_index = 5; //jumping sprite
        en_xscale_set();
    }
    break;
   
   
case 1:
    timeline_position += 1;
    spawn_splash(0,-$18);
    break;
   
   
case 2:
    vspd += 1/8;
    if vspd<0 exit;
    if tile_map_read($6,image_xscale) //($4,$10) //check collision below front foot
    {
        timeline_position += 1;
        y &= ~$F;
        move_stop();
    }
    else
    {
        if y-view_yview + $10 < global.floodzone
        {
            spawn_splash(0,-$18);
            enemy_destroy();
        }
    }
    break;
   
   
case 3:
    image_index = 3; //ducking
    status = STILL;
    timeline_position += 1;
    break;
       

case 4:
    alarm[2] = 6;
    timeline_position += 1;
    break;
   
   
case 5:
case 13:
case 16:
    alarm[2] -= 1;
    if !alarm[2]
        timeline_position += 1;
    break;
   
   
case 6:
    status &= ~STILL;
    status |= MOVING;
    image_index = 0;
    image_speed = 1/$10;
    en_xscale_set();
    hspd = 7/16 * image_xscale;
    timeline_position += 1;
    break;
   
   
case 7:
    alarm[2] = $90;
    timeline_position += 1;
    break;
   
   
case 8:
    if tile_map_read(5,image_xscale) //check collision below ahead
    {
        y &= ~$F;
        if tile_map_read(0,image_xscale) //check collision at knees
        {
            hspd *= -1;
            image_xscale *= -1;
        }
        else
        {
            alarm[2] -= 1;
            if !alarm[2]
            {
                timeline_position += 1;
                status &= ~MOVING;
            }
        }
    }
    else
    {
        hspd *= -1;
        image_xscale *= -1;
    }
    break;
   
   
case 9:
    timeline_position += 1;
    en_xscale_set();
    break;
   
   
case 10:
    status |= STILL;
    timeline_position += 1;
    break;
   
   
case 11:
    image_index = 2;
    timeline_position += 1;
    break;
   
   
case 12:
case 15:
    alarm[2] = $18;
    timeline_position += 1;
    break;
   
   
case 14:
    timeline_position += 1;
    if status & (HIDDEN | OFFSCREEN) break;
    play_sound(snd_31);
    spawn_fireball(8,-9);
    break;
   
   
case 17:
    timeline_position += 1;
    vspd = -1;
    break;
   
   
case 18:
    timeline_position += 1;
    status |= MOVING;
    break;
   
    //Note: This makes the Merman jump with mouth still open
   
case 19:
    vspd += 1/8;
    if y - view_yview + $10 < global.floodzone break;
    timeline_position += 1;
    spawn_splash(0,-$18);
    break;
   
   
case 20:
    timeline_position += 1;
    play_sound(snd_21);
    break;
   
   
case 21:
    instance_destroy();
    break;
}

Mushroom
timeline_index = st_fungus
Code: [Select]
switch timeline_position
{
    case 0:
        sprite_index = spr_Fungus;
        image_speed     =   1/$18;
        image_index     =   0;
        status &= ~STILL;
        break;
       
    case 1:
        if abs(x-Belmont.x) < $20
        if abs(y-Belmont.y) < $20
        exit;
        timeline_position   -=  1;
        break;
       
    case 2:
        image_index = 3;
        image_speed = 1/12;
        timeline_position += 1;
        break;
       
    case 3:
        alarm[2] = $2E;
        timeline_position += 1;
        break;
       
    case 4:
        alarm[2] -= 1;
        if !alarm[2]
            timeline_position += 1;
        break;
       
    case 5:
        var i;
        for (i=4; i>0; i-=1)
        {
            with spawn_new(4,x,y,obj_proj_Spore)
            {
                status = (other.status | MOVING);
                damage_set(1,1); //Set the damage of the spore to low
                switch i
                {
                    case 4:
                            hspd = 5/16;
                            vspd = -1/4;
                            break;
                    case 3:
                            hspd = 5/32;
                            vspd = -1/2;
                            break;
                    case 2:
                            hspd = -5/32;
                            vspd = -1/2;
                            break;
                    case 1:
                            hspd = -5/16;
                            vspd = -1/4;
                            break;
                }
            }
        }
        timeline_position += 1;
        break;
   
    case 6:
        instance_destroy();
        break;
}


Floating Spore
timeline_index = st_fltspore
Code: [Select]
switch timeline_position
{
    case 0:
        sprite_index = spr_FloatSpore;
        image_index = 0;
        image_speed         =   1/$18;
        status &= !STILL;
        status |= MOVING;
        en_xscale_set();
        hspd =3/8 * image_xscale;
        timeline_position += 1;
        break;
       
    case 1:
        alarm[03]           =   $FF;
        vspd = -3/4;
        alarm[02]           =   y - 1;
        timeline_position += 1;
        break;
       
    case 2:
        alarm[03]           -=  1;
        if !alarm[03]
            timeline_position += 1;
        move_sinewave();
        break;
       
    case 3:
        en_xscale_set();
        if status & OFFSCREEN
            xscale *=   -1;
        hspd = (2 + global.hard_mode)/4 * image_xscale);
        vspd = 1/4 * sign(Belmont.y - y | 1);
        timeline_position += 1;
        break;
       
    case 4:
        alarm[02]           =   $20;
        timeline_position += 1;
        break;
       
    case 5:
        alarm[2] -= 1;
        if !alarm[2]
            timeline_position += 1;
        break;
       
    case 6:
        timeline_position = 0;
        break;
}


Spore Pollen
timeline_index = st_spore
These are the baby spores that fungi release when they explode.
Code: [Select]
switch timeline_position
{
    case 0:
        sprite_index = spr_Sporeling;
        image_speed = 1/12;
        image_index = 0;
        status &= ~STILL;
        status |= MOVING;
        timeline_position += 1;
        break;
       
    case 1:
        alarm[2] = $28;
        timeline_position += 1;
        break;
       
    case 2:
        alarm[2] -= 1;
        if !alarm[2]
            timeline_position += 1;
        break;
       
    case 3:
        hspd = irandom($FF)/$100 * sign(hspd);
        vspd += irandom(7)/$100;
        if tile_map_read($14,0) //check for collision with ground
            instance_destroy();
        else
            instance_destroy();
        break;
}


Owl
timeline_index = st_owl
Code: [Select]
switch timeline_position
{
    case 0:
        status &= ~MOVING;
        status |= STILL;
        timeline_position += 1;
        break;
       
    case 1:
        status |= PASSTHRU;
        timeline_position += 1;
        break;
       
    case 2:
        sprite_index = spr_Owl;
        image_speed = 0;
        image_index = 2;
        break;
       
    case 3:
        alarm[02]           =   $0F;
        alarm[03]           =   $00;
        switch irandom(7)
        {
            case 0: alarm[04] = $73; break;
            case 1:
            case 2: alarm[04] = $48; break;
            case 3: alarm[04] = $65; break;
            case 4: alarm[04] = $63; break;
            case 5: alarm[04] = $5C; break;
            case 6: alarm[04] = $8F; break;
            case 7: alarm[04] = $54; break;
        }
        break;
       
    case 4:
        if status & OFFSCREEN
            timeline_position += 1;
       
        alarm[02]           -=  1;
        if !alarm[02]
        {
            alarm[03]           ^=  1;
            if alarm[03]
                alarm[02]           =   $07;
            else
                alarm[02]           =   $28;
            status           ^=  HIDDEN;
        }
        if alarm[04]
            alarm[04]           -=  1;
        if !alarm[04]
        {
            status &= ~HIDDEN;
            timeline_position += 1;
        }
        break;
       
    case 5:
    case 8:
    case 23:
        image_index += 1;
        timeline_position += 1;
        break;
       
    case 6:
        alarm[02]           =   3;
        timeline_position += 1;
        break;
       
    case 7:
    case 10:
    case 14:
    case 18:
    case 21:
    case 30:
        alarm[02] -= 1;
        if !alarm[02]
            timeline_position += 1;
        break;
       
    case 9:
    case 13:
        alarm[2] = $10;
        timeline_position += 1;
        break;
       
    case 11:
        status &= ~PASSTHRU;
        timeline_position += 1;
        break;
       
    case 12:
        image_index = 5;
        timeline_position += 1;
        break;
       
    case 15:
        vspd = -1;
        timeline_position += 1;
   
    case 16:
    case 22:
    case 32:
        status |= MOVING;
        timeline_position += 1;
        break;
       
    case 17:
        alarm[2] = 6;
        timeline_position += 1;
        break;
       
    case 19:
    case 27:
        status &= ~MOVING;
        timeline_position += 1;
        break;
       
    case 20:
        alarm[2] = 4;
        timeline_position += 1;
        break;
       
    case 24:
    case 33:
        en_xscale_set();
        if status & OFFSCREEN
            image_xscale        *=  -1;
           
        switch abs(x-obj_Belmont.x)>>4
        {
            case 0: hspd = 3/4 * image_xscale; break;
            case 1: hspd = 3/2 * image_xscale; break;
            case 2: hspd = 7/4 * image_xscale; break;
            case 3: hspd = 2 * image_xscale; break;
            case 4: hspd = 5/2 * image_xscale; break;
            case 5: hspd = 11/4 * image_xscale; break;
            case 6: hspd = 3 * image_xscale; break;
            case 7: hspd = 7/2 * image_xscale; break;
            case 8: hspd = 15/4 * image_xscale; break;
            case 9: hspd = 9/2 * image_xscale; break;
        }
        switch abs(y-Belmont.y)>>4
        {
            case 0: vspd = 3/2; break;
            case 1: vspd = 7/4; break;
            case 2: vspd = 2; break;
            case 3: vspd = 5/2; break;
            case 4: vspd = 11/4; break;
            case 5: vspd = 3; break;
            case 6: vspd = 7/2; break;
            case 7: vspd = 15/4; break;
            case 8: vspd = 4; break;
            case 9: vspd = 9/2; break;
        }
       
        timeline_position += 1;
        break;
       
    case 25:
    case 34:
        //If you consolidate the code, both Owl scripts go together.
        if !(vspd<0)
        {
            vspd += -1/16;
        }
        else
        {
            sound_play(snd_26);
            image_index = 0;
            image_speed = 1/8;
            image_index         =   0;
            status &= ~STILL;
            alarm[02]           =   $30;
            timeline_position += 1;
        }
        break;
       
    case 26:
        alarm[2] -= 1;
        if !alarm[2]
            timeline_position += 1;
        else
            vspd += -1/16;
        break;
       
    case 28:
        en_xscale_set();
        timeline_position += 1;
        break;
       
    case 29:
        alarm[2] = $20;
        timeline_position += 1;
        break;
       
    case 31:
        image_index = 6;
        status |= STILL;
        timeline_position += 1;
        break;
       
    case 35:
        vspd += -1/16;
        if y < view_yview + $28
            instance_destroy();
        else
        if y > view_yview+$E7
            instance_destroy();
        break;
}


More code to come at some point. Tendinitis is making it hard to work on my PC.
« Last Edit: May 28, 2016, 01:49:58 AM by TheouAegis »
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Thar be dragons here!
« Reply #21 on: May 28, 2016, 10:48:43 AM »
0
DISCLAIMER #2 (or is this #3?)

I just realized since a lot of these codes were written up before I started transitioning to Studio, I use the command exit at times. If you are using Studio, replace all exits in my code with return 0.

In Studio, the exit command is used to abort the current event, whereas return 0 will only abort the current script, which was what was intended originally.
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: Incorporate that old-school feel into your fan games
« Reply #22 on: May 28, 2016, 09:27:26 PM »
0
 just a quick update. Working on the bone dragon code. Decided to actually test it and realized it had some glaring errors. So now I am going back through the game code to make sure I fix those errors. So the next code treat you will all get is the Bone Dragon code from Castlevania 3.
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Do The Bone Dragon!
« Reply #23 on: May 30, 2016, 01:59:42 AM »
0
Bone Dragon Head
timeline_position = st_bonedrach
Okay, this guy requires me to cover a couple details. First, this is the code from my tests. You may notice it's not quite like my other codes - I initialized the alarms, for one thing. This code uses a lot of "alarm" variables. If you can come up with some better names, go for it. I actually created a variable name for one of them - dir. This functions like you'd expect - the dragon moves irrespective of the xscale. The other variables, I didn't really know what to call them. I still use alarm[2] for a timer and alarm[3] is also a timer (of sorts). In addition, alarm[4] functions kinda as cycle counter - so like a timer. The other three alarms (9,10,and 11) are additional cycle counters. I thought about making a new array (something like cycle[n]) but decided it would be easier to just stick with the alarm array with little notes to myself. You don't need to worry about the notes, because they were only pertinent to the original RAM addresses.

Also, unrelated to my transliteration, there is a glaring issue with the original Bone Dragon code. The range of motion is about 50% greater when facing right than facing left. What this means is the bone dragon will spit fire occasionally (rarely) above its tail height when facing right. If it is facing left, it will never move up above its tail, so it will always spit fire at a height lower than its tail. What this means for level design is when the bone dragon will face left, you should place it above Belmont, and when it's facing right it should be placed level to Belmont's head or hip.

In the code, you'll see alarm[4] & $F0 | 2 and alarm[4] & $0F | $80. In both these situations, the original code was suspect because the 2 and $80 were indirect variables, not constants. The buffered values were respectively $02 $02 $02 $02 $02 $02 $02 $02 and $80 $80 $80 $80 $80 $80 $80 $80. Pretty suspect, yeah?

Code: [Select]
switch timeline_position
{
    case 0:
        sprite_index = spr_DracHead;
        status |= STILL;
        image_index = 0;
        image_xscale = 1; //You'd set this when it's created (doesn't face Belmont)
        dir = image_xscale;
        //In GM8, alarms start at -1, so I need to remember to clear them.
        alarm[2] = 0;
        alarm[3] = 0;
        alarm[4] = 0;
        alarm[9] = 0;
        alarm[10] = 0;
        alarm[11] = 0;
        timeline_position += 1;
        break;
   
    case 1:
        if status & OFFSCREEN break;
        alarm[3] = 2;
        status |= MOVING;
        hspd = 1 * dir;
        alarm[10] = $30;
        alarm[2] = 9;
        timeline_position += 1;
        break;
       
    case 2:
        alarm[2] -= 1;
        if alarm[2] break;
        if alarm[3] != 8
        {
            global.instance[global.index] = instance_create(x-8*image_xscale,y,obj_DracRib);
            with global.instance[global.index]
            {
                image_xscale = other.image_xscale;
                status = other.status;
                damage = $10;
                hp = $20;
            }
            global.index += 1;
            alarm[3] += 1;
            alarm[2] = 9;
        }
        else
        {
            hspd = 0;
            status &= ~MOVING;
            var i,n;
            n = $10*(dir != 1) + 8;
            for(i=1;i<9;i+=1)
            with global.instance[i]
            {
                alarm[9] = 0;
                alarm[2] = n;
                alarm[3] = n;
                alarm[4] = $82;
                timeline_position = 2;
            }
            timeline_position += 1;
        }
        break;
   
    case 3:
        var i,k;
        for(i=1;i<9;i+=1;)
        with global.instance[i]
        {
            k = alarm[4] & $F;
            k -= 1;
            if k
                alarm[4] = (alarm[4] & $F0) | k;
            else
            {
                alarm[4] = (alarm[4] & $F0) | 2;
                k = alarm[3] - alarm[2] & $FF;
                if k
                if k & $10
                    alarm[2] = alarm[2] - 1 & $1F;
                else
                    alarm[2] = alarm[2] + 1 & $1F;
            }
               
            k = alarm[4] & $F0;
            k -= $10;
            if k
                alarm[4] = alarm[4] & $0F | k;
            else
            {
                alarm[4] = alarm[4] & $0F | $80;
                if i!=8
                    alarm[3] = global.instance[i+1].alarm[2];
                else
                {
                    switch alarm[9]+$1F*(!dir)
                    {
                        case 30:
                        case 61:    alarm[9] = 0;
                        case 0:
                        case 5:
                        case 6:
                        case 7:
                        case 8:
                        case 12:
                        case 18:
                        case 19:
                        case 26:
                        case 27:
                        case 28:    alarm[3] = $08; break;
                        case 1:
                        case 2:
                        case 15:
                        case 20:
                        case 21:
                        case 22:
                        case 23:    alarm[3] = $0E; break;
                        case 3:
                        case 4:
                        case 16:
                        case 17:
                        case 25:    alarm[3] = $0A; break;
                        case 9:     alarm[3] = $06; break;
                        case 10:
                        case 11:
                        case 29:    alarm[3] = $04; break;
                        case 13:
                        case 14:
                        case 24:    alarm[3] = $0C; break;
                        case 31:
                        case 36:
                        case 37:
                        case 38:
                        case 39:
                        case 43:
                        case 49:
                        case 50:
                        case 57:
                        case 58:
                        case 59:    alarm[3] = $18; break;
                        case 32:
                        case 33:
                        case 46:
                        case 51:
                        case 52:
                        case 53:
                        case 54:    alarm[3] = $12; break;
                        case 34:
                        case 35:
                        case 47:
                        case 48:
                        case 56:    alarm[3] = $16; break;
                        case 40:    alarm[3] = $1A; break;
                        case 41:
                        case 42:
                        case 44:
                        case 45:
                        case 55:
                        case 60:    alarm[3] = $14; break;
                    }
                    alarm[9] += 1;
                }           
            }
        }
       
        for(i=1;i<7;i+=1)
        with global.instance[i]
        {
            switch alarm[2]
            {
                case 0:
                case 16:    k = 0; break;
                case 1:
                case 15:    k = 2; break;
                case 2:
                case 14:    k = 3; break;
                case 3:
                case 13:    k = 5; break;
                case 4:
                case 12:    k = 6; break;
                case 5:
                case 11:    k = 7; break;
                case 6:
                case 10:    k = 8; break;
                case 7:
                case 8:
                case 9:     k = 9; break;
                case 17:
                case 31:    k = -2; break;
                case 18:
                case 30:    k = -3; break;
                case 19:
                case 29:    k = -5; break;
                case 20:
                case 28:    k = -6; break;
                case 21:
                case 27:    k = -7; break;
                case 22:   
                case 26:    k = -8; break;
                case 23:
                case 24:
                case 25:    k = -9; break;
            }
           
            global.instance[i+1].x = x + k;
           
            switch alarm[2]
            {
                case 8:
                case 24:    k = 0; break;
                case 9:
                case 23:    k = 2; break;
                case 10:
                case 22:    k = 3; break;
                case 11:
                case 21:    k = 5; break;
                case 12:
                case 20:    k = 6; break;
                case 13:
                case 19:    k = 7; break;
                case 14:
                case 18:    k = 8; break;
                case 15:
                case 16:   
                case 17:    k = 9; break;
                case 25:
                case 7:     k = -2; break;
                case 26:
                case 6:     k = -3; break;
                case 27:
                case 5:     k = -5; break;
                case 28:
                case 4:     k = -6; break;
                case 29:
                case 3:     k = -7; break;
                case 2:     k = -8; break;
                case 0:
                case 1:
                case 30:
                case 31:    k = -9; break;
            }
           
            global.instance[i+1].y = y + k;
           
            if alarm[2] && alarm[2]<17
                global.instance[i+1].image_xscale = -1;
            else
                global.instance[i+1].image_xscale = 1;
               
            switch alarm[2]
            {
                case 0:
                case 1:     image_index = 2; break;
                case 2:
                case 3:
                case 4:
                case 5:
                case 6:     image_index = 3; break;
                case 7:
                case 8:
                case 9:
                case 10:
                case 23:
                case 24:
                case 25:
                case 26:    image_index = 4; break;
                case 11:
                case 12:
                case 13:
                case 14:
                case 18:
                case 19:
                case 20:
                case 21:
                case 22:    image_index = 5; break;
                case 15:
                case 16:    //image_index 2 mirrored
                case 17:    image_index = 6; break;
            }
        }

        x = global.instance[7].x + 15*dir;
        y = global.instance[7].y;
       
        if alarm[10]
            alarm[10] -= 1;
        else
        {
            if status & (HIDDEN | OFFSCREEN)
            {
                image_index = 0;
                alarm[11] = 0;
                alarm[10] = $80;
            }
            else
            if alarm[11]
            {
                with instance_create(x+8,y+4,obj_Fireball)
                {
                    image_xscale = other.image_xscale;
                    hspd = 2 * image_xscale;
                    status = MOVING | STILL;
                }
                alarm[11] = 0;
                alarm[10] = $80;
            }
            else
            {
                image_index = 1;
                alarm[10] = $10;
                alarm[11] += 1;
            }
        }
       
        for(i=1;i<9;i+=1;)
        if !global.instance[i]
        {
            (global.instance[1].mySpawn).alarm[1] = 2; //tell the spawner it died
            for(i=8;i;i-=1)
            with global.instance[i]
                instance_destroy();
            return 0;
        }
        break;
}


Bone Dragon Rib
timeline_index = st_bonedract
Code: [Select]
switch timeline_position
{
    case 0:
        sprite_index = spr_DracRib;
        status |= STILL;
        image_index = 2;
        timeline_position += 1;
        break;
   
    case 1: //This is blank because, well, nothing happens.
            break;
       
    case 2: //Same code as in the head
        var i;
        for(i=1;i<9;i+=1)
        if !global.instance[i]
        {
            (global.instance[1].mySpawn).alarm[1] = 2;
            for(i=8;i;i-=1;)
                with global.instance[i]
                    instance_destroy();
            exit;
        }
        break;
}
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: Incorporate that old-school feel into your fan games
« Reply #24 on: May 31, 2016, 11:46:37 AM »
0
Flying Eye
timeline_index = st_flyeye
Code: [Select]
switch timeline_position
{
    case 0:
        sprite_index = spr_FlyingEye;
        image_speed = 1/$A;
        image_index     =   0;
        status &= ~STILL; //junk line
        status |= MOVING;
        en_xscale_set();
        hspd = 69/64;
        timeline_position += 1;
        break;
       
    case 1:
        alarm[2] = $20;
        timeline_position += 1;
        break;
       
    case 2:
    case 6:
    case 9:
    case 12:
        alarm[2] -= 1;
        if !alarm[2]
            timeline_position += 1;
        break;
       
    case 3:
        status |= STILL;
        status &= ~MOVING;
        timeline_position += 1;
        break;
       
    case 4:
    case 7:
        image_index += 1;
        timeline_position += 1;
        break;
       
    case 5:
    case 8:
        alarm[2] = $10;
        timeline_position += 1;
        break;
       
    case 10:
        image_index -= 1;
        timeline_position += 1;
        break;
       
    case 11:
        alarm[2] = $4;
        timeline_position += 1;
        break;
       
    case 13:
        timeline_position += 1;
        if status & (HIDDEN|OFFSCREEN) break;
        sound_play(snd_31);
        spawn_teardrop(4*image_xscale,4); //spawn a tear at (x+4,y+4)
        break;
       
    case 14:
        timeline_position = 0;
        break;
}

Teardrop
timeline_index = st_teardrop
Code: [Select]
switch timeline_position
{
    case 0:
        sprite_index = spr_Teardrop;
        vspd = 3/2;
        status |= STILL | MOVING;
        image_speed = 0;
        image_index = 0;
        timeline_position += 1;
        break;
       
    case 1:
        //No gravity, if I remember right
        if tile_map_read($14,0) //check for collision below
            instance_destroy();
        else
            projectile_destroy(); //just remembered, this is just a destroy-if-offscreen script
        break;
}


Axe Knight
timeline_index = st_axeknight
Code: [Select]
switch timeline_position
{
    case 0:
        var i,k;
        en_xscale_set();
        status |= MOVING;
        sprite_index = spr_AxeKnight;
        image_speed = 1/14;
        image_index = 0;
        //This gets called at two different phases in the Axe Knight timeline
        if (alarm[04] & $30)
        {
            if !(alarm[04] & $80)
            {
                i   =   (alarm[04] & $30) - $10;
                alarm[04]   =   alarm[04] & $CF | i;
            }
            k   =   1;   
        }
        else
        {
            if !(status & (HIDDEN | OFFSCREEN))
            for (i=0; i<$D; i+=1)
            if !global.instance[i] //find empty spot in instances array to spawn axe
            {
                status |= STILL;
                status &= ~MOVING;
                if irandom(1)
                    sprite_index    =   spr_AxeKnight_dkat;
                else
                    sprite_index    =   spr_AxeKnight_stat;
                alarm[04]   |=  $10;
                timeline_position   +=  1;
            }
            k   =   1;
        }
        if k == 1
        {
            alarm[03]   =   $21;
            en_xscale_set();
           
            if abs(x-obj_Belmont.x) < $60
                hspd = -3/2 * image_xscale;
            else
                hspd = 3/2* image_xscale;
            if status & OFFSCREEN
                hspd *= -1;
        }
        break;
       
    case 1:
        var i;
        i = instance[alarm[04] & $0F];
        if alarm[04] & $80
        {
            if !i
                alarm[04]   &=  $7F;
            else
            if abs(x-i.x) < $04
            {
                alarm[04]   &=  $7F;
                with i
                    instance_destroy();
            }
        }
       
        switch tile_map_read(5,2) //check collision below
        {
            case 0:
            case 4:
                    hspd *= -1;
                    break;
                   
            default:
                    if tile_map_read(0,2) //check collision in front of knees
                        hspd *= -1;
                    else
                    if tile_map_read(3,2) //check collision in front of face
                        hspd *= -1;
                    else
                    {
                        alarm[03]   -=  1;
                        var k;
                        if !alarm[03]
                        //This gets called at two different phases in the Axe Knight timeline
                        if (alarm[04] & $30)
                        {
                            if !(alarm[04] & $80)
                            {
                                i   =   (alarm[04] & $30) - $10;
                                alarm[04]   =   alarm[04] & $CF | i;
                            }
                            k   =   1;   
                        }
                        else
                        {
                            if !(status & (HIDDEN | OFFSCREEN))
                            for (i=0; i<$D; i+=1)
                            if !spawn_data[i]
                            {
                                status |= STILL;
                                status &= ~MOVING;
                                if irandom(1)
                                    image_index    =   4;
                                else
                                    image_index    =   2;
                                alarm[04]   |=  $10;
                                timeline_position   +=  1;
                            }
                            k   =   1;
                        }
                        if k == 1
                        {
                            alarm[03]   =   $21;
                            en_xscale_set();
                            if status & OFFSCREEN
                                image_xscale    *=  -1;
                           
                            if abs(x-obj_Belmont.x) < $60
                                hspd = -3/8;
                            else
                                hspd = 3/8 * image_xscale;
                            if status & OFFSCREEN
                                hspd *= -1;
                        }
                    }
                    break;
        }
        break;

    case 2:
        alarm[02]   =   $0A;
        timeline_position += 1;
        break;
   
    case 3:
    case 6:
        alarm[02] -= 1;
        if !alarm[02]
            timeline_position += 1;
        break;
       
    case 4:
        image_index += 1;
        timeline_position += 1;
        break;
       
    case 5:
        alarm[2] = $08;
        timeline_position += 1;
        break;
       
    case 7:
        var i,k;
        if image_index & 4
            i           =   -10;
        else
            i           =   9;
        //spawn axe at (x+8,y+i) and save its instance array index
        k           =   (spawn_axe(8,i)).myIndex | $80;
        alarm[04]        =   alarm[04] & $70 | k;
        status &= ~STILL;
        timeline_position   =   0;
        break;
}

Axe (for axe knight)
timeline_position = st_knightaxe
Code: [Select]
switch timeline_position
{
    case 0:
        sprite_index = spr_Axe;
        status |= MOVING;
        image_speed = 1/4;
        image_index = 0;
        en_xscale_set;
        hspd = 3/2 * image_xscale;
        timeline_position += 1;
        break;
       
    case 1:
        alarm[2] = $38;
        timeline_position += 1;
        break;
       
    case 2:
        alarm[2] -= 1;
        if !alarm[2]
            timeline_position += 1;
        break;
       
    case 3:
        hspd *= -1;
        timeline_position += 1;
        break;
       
    case 4:
        timeline_index = -1;
        break;
}
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
I Want My Mummy!
« Reply #25 on: June 01, 2016, 11:01:20 AM »
0
Mummy
timeline_index = st_mummy
Code: [Select]
switch timeline_position
{
    case 0:
        sprite_index = spr_Wrap;
        image_speed = 1/$C;
        status &= ~STILL;
        timeline_position += 1;
        break;
   
    case 1:
        alarm[2] = $3A;
        timeline_position += 1;
        break;
       
    case 2:
    case 10:
        alarm[2] -= 1;
        if !alarm[2]
            timeline_position += 1;
        break;
       
    case 3:
        sprite_index = st_Mummy;
        image_speed = 1/$C;
        image_index = 0;
        status |= MOVING;
        en_xscale_set();
        hspd = 7/16 * image_xscale;
        timeline_position += 1;
        break;
       
    case 4:
        y               &=  ~15;
        var i;
        if !tile_map_read($05,1) //check for no ground ahead
            i       =   1;
        if tile_map_read($00,1) //check for collision in front of knees
            i       =   1;
       
        if i
        {
            hspd *= -1;
            image_xscale *= -1;
        }
        else
        {
            alarm[02]           -=  1;
            if !alarm[02]
            {
                status &= ~MOVING;
                timeline_position += 1;
            }
        }
        break;
       
    case 5:
        en_xscale_set();
        timeline_position += 1;
        break;
       
    case 6:
        status |= STILL;
        timeline_position += 1;
        break;
       
    case 7:
        hspd = 0;
        timeline_position += 1;
        //junk state if you think about it
        break;
       
    case 8:
        if !(status & (HIDDEN|OFFSCREEN))
        {
            sound_play(snd_31);
            spawn_wrap(8,-4);
        }
        timeline_position += 1;
        break;
       
    case 9:
        alarm[2] = $18;
        timeline_position += 1;
        break;
       
    case 11:
        timeline_position = 3;
        break;
}

Bandage
timeline_index = st_wrap
Code: [Select]
switch timeline_position
{
    case 0:
        sprite_index = spr_Bandage;
        status |= MOVING;
        image_speed = 1/$C;
        image_index = 0;
        timeline_position += 1;
        break;
       
    case 1:
        vspd = -1;
        ystart           =   y;
        timeline_position += 1;
        break;
       
    case 2:
        move_sinewave();
        break;
}


Harpy
timeline_index = st_harpy
Code: [Select]
//Compressing this code will make it unnoticably faster
switch timeline_position
{
    case 0:
        status &= ~MOVING;
        status |= STILL;
        timeline_position += 1;
        //junk state
        break;
       
    case 1:
        status |= MOVING;
        en_xscale_set();
        move_stop();
        move_horz_set($0210/$100,1);
        timeline_position += 1;
        break;
       
    case 2:
        sprite_index = spr_Harpy;
        image_index = 0;
        image_speed = 1/$C;
        timeline_position += 1;
        break;
       
    case 3:
        if abs(x-obj_Belmont.x) < $40
            timeline_position   +=  1;
        break;
       
    case 4:
        with spawn_new(2,x+0,y+$10,obj_Fleaman)
        {
            image_xscale        =   other.image_xscale;
            status = other.status|(STILL|MOVING);
            damage_set($20);
            timeline_index = st_fleabomb;
            with other
            {
                image_index = 0
                status &= ~MOVING;
                status |= STILL;
                alarm[02]           =   $10;
                timeline_position   +=  1;
            }
        }
        break;
       
    case 5:
    case 8:
        alarm[2] -= 1;
        if !alarm[2]
            timeline_position += 1;
        break;
       
    case 6:
        image_index = 2;
        timeline_position += 1;
        break;
       
    case 7:
        alarm[2] = $10;
        timeline_position += 1;
        break;
       
    case 9:
        status |= MOVING;
        timeline_position += 1;
        break;
       
    case 10:
        status &= ~STILL;
        timeline_position += 1;
        break;
       
    case 11:
        timeline_index = -1; //tells controller to ignore this unit
        break;
}

Fleaman Bomb
timeline_index = st_fleabomb
Code: [Select]
switch timeline_position
{
    case 0:
        status |= STILL;
        timeline_position += 1;
        break;
       
    case 1:
        alarm[2] = $10;
        timeline_position += 1;
        break;
       
    case 2:
        alarm[2] -= 1;
        if !alarm[2]
            timeline_position += 1;
        break;
       
    case 3:
        sprite_index = spr_Fleaman;
        image_index =   0;
        image_speed =   0;
        status |= STILL;
        timeline_position += 1;
        break;
       
    case 4:
        status |= MOVING;
        timeline_position += 1;
        break;

    case 5:
        vspd += 5/64;
        if tile_map_read($E,1) //check for collision below
        {
            y                   &=  ~15;
            vspd = 0;
            hspd = 0;
            alarm[03]           =   0;
            timeline_index      =   st_fleaman;
            timeline_position   +=  1;
        }
        break;
}


Spider
timeline_index = st_spider
Comprised of three parts - the spider itself, its webbing, and the babies.
Code: [Select]
switch timeline_position
{
    case 0:
        status |= PASSTHRU;
        WEB = (spawn_thread(0,0)).id;
        sprite_index = spr_Spider
        status &= ~(STILL|FLICKER);
        image_speed = 1/$C;
        image_index = 0;
        timeline_position += 1;
        break;
       
    case 1:
        with WEB
        {
            timeline_position = 0;
            alarm[2] = other.id;
        }
    case 10:
        move_stop();
        status |= MOVING;
        timeline_position += 1;
        vspd = 9/8;
        if (timeline_position==10)
            vspd = -(vspd + 1/8);
        alarm[2] = $50; //always felt this should be randomized
        break;
       
    case 2:
        status &= ~PASSTHRU; //2-frame invincibility seems pointless...
        timeline_position += 1;
        break;   
   
    case 3:
    case 11:
        if y-view_yview < $30
        {
            status |= (PASSTHRU|HIDDEN|FLICKER);
            timeline_position += 1;
            y = $30+view_yview; //base of status bar
            vspd = 0;
            with WEB
                instance_destroy();
            exit;
        }
    case 6:
    case 9:
    case 15:
        alarm[2] -= 1;
        if !alarm[2]
            timeline_position += 1;
        break;
       
    case 4:
        vspd = 0; //originally in 3 but moved here
        status &= ~MOVING;
        timeline_position += 1;
        break;
       
    case 5:
        alarm[2] = $10;
        timeline_position += 1;
        break;
       
    case 7:
        timeline_position += 1;
        if abs(x-view_xview-$80) >= $78 exit;
        if status & (HIDDEN|OFFSCREEN) break;
        spawn_spiderling(0,0);
        play_sound(snd_31) //play flutter sound
        break;
       
    case 8:
        alarm[2] = $10;
        timeline_position += 1;
        break;
       
    case 12:
        timeline_position += 1;
        var temp;
        switch irandom(7)
        {
            case 0:
                temp = $40;
                break;
               
            case 1:
                temp = $20;
                break;
               
            case 2:
                temp = $E0;
                break;
               
            case 3:
                temp = $D0;
                break;
               
            case 4:
                temp = $10;
                break;
               
            case 5:
                temp = $F0;
                break;
               
            case 6:
                temp = $50;
                break;
               
            case 7:
                temp = $70;
                break;
        }
        x = (Belmont.x - view_xview + temp & $FF) + view_xview;
        break;
       
    case 13:
        timeline_position += 1;
        en_xscale_set(); //Why? It's a mirrored sprite and baby was already made!
        break;
       
    case 14:
        switch irandom(3)
        {
            case 0:
                alarm[2] = $F8;
                break;
               
            case 1:
                alarm[2] = $B0;
                break;
               
            case 2:
                alarm[2] = $A0;
                break;
               
            case 3:
                alarm[2] = $C8;
                break;
        }
        timeline_position += 1;
        break;
       
    case 16:
        timeline_position = 0;
        break;
}

Spider Web
timeline_index = st_thread
Who knew a spider web had so much code!
Code: [Select]
switch timeline_position
{
    case 0:
        timeline_position += 1;
        sprite_index = spr_Thread;
    case 1:
        image_index = SPIDER.y-$30>>4;
        status = SPIDER.status | (STILL | PASSTHRU) & ~(MOVING);
        break;
}

Spiderling
timeline_index = st_spiderling
Okay, this one's a doozy. All the data is stored in an external binary file. If you can buffer this in GM, that should speed up the code quite a bit, since file reading is kinda poor in GM. I'll include the file data below.
Code: [Select]
switch timeline_position
{
    case 0:
        timeline_position += 1;
        sprite_index = spr_Spiderling;
        image_speed = 1/$18;
        break;
       
    case 1:
        timeline_position += 1;
        var temp; var f;
        temp[2] = abs(Belmont.y-y) & $F0;
        temp[1] = abs(Belmont.x-x)>>4;
        temp[0] = Belmont.x<x;
        temp[0] |= (Belmont.y<y)<<1;

        f = file_bin_open("babyspdr0.bin",0);
        file_bin_seek(f,temp[1]+temp[2]);
        temp[1] = file_bin_read_byte(f);
        switch temp[0]
        {
            case 3:
                temp[0] = $18;
            case 0:
                temp[1] = $08 - temp[1];
                break;
            case 1:
                temp[0] = $10;
            case 2:
                temp[0] = $00;
                break;
        }
        temp[0] += temp[1];
        file_bin_close(f);
       
        temp[3] = abs(abs($18-temp[0])-$10)+$12<<1;
       
        f = file_bin_open("babyspdr1.bin",0);
        file_bin_seek(f,temp[3]);
        temp[4] = file_bin_read_byte(f)<<8;
        if temp[4] & $8000
            temp[4] = $10000-temp[4];
        temp[4] |= file_bin_read_byte(f);
        file_bin_seek(f,$36+temp[3]);
        temp[5] = file_bin_read_byte(f)<<8;
        if temp[5] & $8000
            temp[5] = $10000-temp[5];
        temp[5] |= file_bin_read_byte(f);
        file_bin_close(f);
       
        move_vert_set(temp[4]/$100,0);
        move_horz_set(temp[5]/$100,0);
       
        if temp[0] & $10
            hspd *= -1;
        if temp[0]+$08 & $10
            vspd *= -1;
        break;
       
    case 2:
        if x-view_xview < $4
            instance_destroy();
        else
        if x-view_xview > $F7
            instance_destroy();
        else
        if y-view_yview < $18
            instance_destroy();
        else
        if y-view_yview > $E7
            instance-destroy();
        break;
}

Spiderling Data 0
filename = babyspdr.bin
Code: [Select]
04 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08 00 04 06 06 07 07 07 07 07 07 07 08 08 08 08 08 00 02 04 05 06 06 06 07 07 07 07 07 07 07 07 07 00 02 03 04 05 05 06 06 06 06 07 07 07 07 07 07 00 01 02 03 04 05 05 05 06 06 06 06 06 06 07 07 00 01 02 03 03 04 04 05 05 05 06 06 06 06 06 06 00 01 02 02 03 04 04 04 05 05 05 05 06 06 06 06 00 01 01 02 03 03 04 04 04 05 05 05 05 05 06 06 00 01 01 02 02 03 03 04 04 04 05 05 05 05 05 06 00 01 01 02 02 03 03 03 04 04 04 05 05 05 05 05 00 01 01 01 02 02 03 03 03 04 04 04 04 05 05 05 00 00 01 01 02 02 03 03 03 03 04 04 04 04 05 05 00 00 01 01 02 02 02 03 03 03 04 04 04 04 04 05 00 00 01 01 02 02 02 03 03 03 03 04 04 04 04 04 00 00 01 01 01 02 02 02 03 03 03 03 04 04 04 04 00 00 01 01 01 02 02 02 02 03 03 03 03 04 04 04
Spiderling Data 1
filename = babyspdr1.bin
Code: [Select]
FF 00 FF 06 FF 14 FF 2C FF 4C FF 72 FF 9E FF CF 00 00 FE 80 FE 88 FE 9E FE C1 FE F1 FF 2B FF 6B FF B6 00 00 FE 00 FE 0B FE 27 FE 57 FE 97 FE E4 FE 3C FE 9D 00 00 00 00 00 31 00 62 00 8E 00 B4 00 D4 00 EC 00 FA 01 00 00 00 00 4A 00 93 00 D5 01 0F 01 3F 01 62 01 78 01 80 00 00 00 63 00 C4 01 1C 01 69 01 A9 01 D9 01 F5 02

So unless I'm mistaken, that should be it for the CV3 minor enemies. Next time, I'll post code from CV1 for all of the enemies, including the bosses.
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline Inccubus

  • Wannabe Great Old One
  • Master Hunter
  • *****
  • Posts: 3265
  • Gender: Male
  • Warrior
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. SuperOld Dungeonite: Members who have been around since the oldOLD days. Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Vampire Killer (MSX)
  • Likes:
Re: Incorporate that old-school feel into your fan games
« Reply #26 on: June 03, 2016, 01:37:03 PM »
0
Thisinfo has been so useful, dude! I appreciate the work you've put in. I look forward to the NES enemies, too.
"Stuff and things."

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Boss Rush Mode
« Reply #27 on: June 03, 2016, 03:32:19 PM »
0
NOTICE: The first enemy is the big bat boss from the first part of the game. This isn't just because it was the first boss, but also because its scripts (there are 4) are referenced by other bosses as well.


Vampire Bat
timeline_index = st_cvbat
Code: [Select]
switch timeline_position
{
case 0:
    status |= STILL;
    status &= ~MOVING;
    if !(system.status & $F0) //if boss fight
        exit;
    alarm[2] = $78;
    timeline_position += 1;
    break;


case 1:
    alarm[2] -= 1;
    if !alarm[2]
    {
        sc_cvbat0();
        sprite_index = spr_VampireBat;
    }
    break;
   
   
case 2:
    if abs(Belmont.y - y) < 4
    {
        switch irandom(3)
        {
            case 0: alarm[2] = $7B; break;
            case 1: alarm[2] = $20; break;
            case 2: alarm[2] = $3D; break;
            case 3: alarm[2] = $C7; break;
        }
        status &= ~MOVING;
        timeline_position += 1;
    }
    break;
   
   
case 3:
    alarm[2] -= 1;
    if alarm[2]
    {
        if !irandom(15)
        {
            if abs(Belmont.y-y) < $14
            {
                var temp; temp = abs(Belmont.x-x);
                if temp < $58
                if sign(temp) == image_xscale
                {
                    vspd = -5/2;
                    hspd = 0;
                    alarm[2] = 8;
                    timeline_position = 4;
                }
            }
        }
    }
    else
    {
        var temp; temp = global.instance[0].y - y;
        if temp < 0
        {
            with spawn_fireball(0,0) //C to D
                sc_cvbat2();
            alarm[2] = $18;
            timeline_position = 6;
        }
        else
        {
            var temp; temp = sc_cvbat1(0,$18);
            sc_cvbat3(temp);
            timeline_position = 5;
        }
    }   
    break;
   
   
case 4:
    alarm[2] -= 1;
    if !alarm[2]
    {
        if global.instance[0].y < y
        {
            with spawn_fireball(0,0)
                sc_cvbat2();
            alarm[2] = $18;
            timeline_position = 6;
        }
        else
        {
            var temp; temp = sc_cvbat1(0,$18);
            sc_cvbat3(temp);
            timeline_position = 5;
        }
    }
    break;
   
   
case 5:
    vspd += 3/128;
    if vspd < 0 && y-view_yview < $70
        sc_cvbat0();
    else
    {
        if x < $10
        {
            x = $10;
            hspd *= -1;
            image_xscale *= -1;
        }
        else
        if x > $EF
        {
            x = $F0;
            hspd *= -1;
            image_xscale *= -1;
        }
    }
   
case 6:
    alarm[2] -= 1;
    if !alarm[2]
        sc_cvbat0();
}

Bat Subscript 0
script_id = sc_cvbat0
Code: [Select]
var temp; temp[1] = irandom(1);
temp[0] = $30;
if temp[1]
    temp[0] = -temp[0];
temp[1] = temp[0] + Belmont.x - view_xview;
if temp[1] < $10 || temp[1] > $EF
    temp[0] = -temp[0];

temp[1] = sc_cvbat1(temp[0],$28);
temp[0] = temp[1] & 1;
temp[1] = temp[1] >> 1;
temp[1] -= temp[1]>>2;
temp[1] /= $100;

if temp[0]
{
    hspd = temp[1] * image_xscale;
    vspd = 3/4;
}
else
{
    vspd = temp[1];
    hspd = 3/4 *image_xscale;
}
    if alarm[5]
        vspd *= -1;

timeline_position = 2;

Bat Subscript 1
script_id = sc_cvbat1
The value returned by this code may be ±1 the intended value due to rounding in GM. However, considering what this code is used for, it shouldn't be a noticeable difference.
Code: [Select]
en_xscale_set();
var temp;
temp[3] = Belmont.y + argument1 - y;
temp[1] = max(abs(temp[3]),1);
alarm[5] = !temp[1];
temp[3] = Belmont.x + argument0 - x;
temp[2] = max(abs(temp[3]),1);

if temp[2] < temp[1]
{
    temp[0] = temp[2];
    temp[1] = temp[1];
    temp[3] = 1;
}
else
{
    temp[0] = temp[1];
    temp[1] = temp[2];
    temp[3] = 0;
}

return floor(temp[0]/temp[1] * $100) << 1 | temp[3];

Bat Subscript 2
script_id = sc_cvbat2
Code: [Select]
var temp; temp[1] = sc_cvbat1(0,0);
temp[0] = temp[1] & 1;
temp[1] = temp[1] >> 1;
temp[1] += temp>>1;
temp[1] /= $100;

if temp[0]
{
    hspd = temp[1] * image_xscale;
    vspd = 3/2;
}
else
{
    vspd = temp[1];
    hspd = 3/2 * image_xscale;
}
if alarm[5]
    vspd *= -1;

Bat Subscript 3
script_id = sc_cvbat3
Code: [Select]
var temp; temp[1] = argument0;
temp[0] = temp[1] & 1;
temp[1] &= ~1;
temp[1] /= $100

if temp[0]
{
    hspd = temp[1] * image_xscale;
    vspd = 2;
}
else
{
    vspd = temp[1];
    hspd = 2 * image_xscale;
}
if alarm[5]
    vspd *= -1;


Medusa Bust
timeline_index = st_cvmedusa
Medusa has a flashing palette swap, like the Bone Pillars.
Code: [Select]
switch timeline_position
case 0:
    status |= STILL;
    status &= ~MOVING;
    if !(system.status & $F0) //if boss fight
        exit;
    alarm[2] = $B4;
    ystart = y + 4;
    timeline_position += 1;
    break;


case 1:
    alarm[2] -= 1;
    if alarm[2] exit;
   
    //Replace tiles under bust
   
    status &= ~STILL;
    status |= MOVING;
    alarm[3] = irandom(3);
    sprite_index = spr_MedusaBust;
    image_speed = 1/8;
    vspd = 1/2;
    timeline_position = 2;
    break;
   

case 2:
    if y-view_yview < $A8
    {
        en_xscale_set();
        hspd = 15/8 * image_xscale;
        alarm[3] = alarm[3] + 1 & 3;
        switch other.alarm[3]
        {
            case 0: alarm[2] = $10; break;
            case 1: alarm[2] = $80; break;
            case 2: alarm[2] = $40; break;
            case 3: alarm[2] = $A0; break;
        }
        spawn_medsnake(0,0);
        timeline_position = 3;       
    }
    break;
   

case 3:
    alarm[2] -= 1;
    if alarm[2]
    {
        move_sinewave(0);
        if x-view_xview < $10
        {
            hspd *= -1;
            image_xscale *= -1;
        }
        else
        if x-view_xview > $EF
        {
            hspd *= -1;
            image_xscale *= -1;
        }
    }
    else
    {
        timeline_position = 4;
        vspd = 0;
        alarm[2] = $3C;
    }
    break;
   
   
case 4:
    alarm[2] -= 1;
    if !alarm[2]
    {
        vspd = 1/2;
        timeline_position = 2;
    }
    break;
}


//Flash the palette
if !(image_index mod 1)
{
    sprite_index = spr_MedusaFlash;
}

Medusa's Snake
timeline_index = st_cvsnake
Code: [Select]
switch timeline_position
{
case 0:
    sprite_index = spr_MedusaSnake;
    image_speed = 1/8;
    en_xscale_set();
    vspd = 0;
    timeline_position = 1;
    break;
   
   
case 1:
    //Oddly, this used friction instead of gravity in code.
    vspd += 1/8;
    //Check for collision below
    if tile_map_read($2E,0) //bbox_bottom 8 pixels above base
    {
        vspd = 0;
        y &= ~7;
        hspd = 3/2 * image_xscale;
        alarm[2] = $18;
        timeline_position = 2;
    }
    break;
   

case 2:
    alarm[2] -= 1;
    if alarm[2]
        timeline_position = 3;
    else
    if !tile_map_read($2E,0) //see prev note
    {
        en_xscale_set();
        vspd = 0;
        hspd = 0;
        timeline_position = 1;
    }   
    break;
   
   
case 3:
    en_xscale_set();
    hspd = 3/2 * image_xscale;
    alarm[2] = $18;
    timeline_position = 2;
    break;
}


Twin Mummies
timeline_index = st_cvmummy
Another flashing palette swap enemy. It also requires a step counter, so you can't use irandom() in place of system.alarm[0] in this code.
Code: [Select]
switch timeline_position
{
case 0:
    sprite_index = spr_TwinMummy;
    palette = 0;
    image_speed = 1/16;
    status = STILL | PASSTHRU;
    if !(system.status & $F0) //if boss fight
        exit;
    alarm[3] = myIndex + irandom(3);
    //584 = $20
    //530 = $00
    alarm[2] = $78;
    timeline_position += 1;
    break;


case 1:
    alarm[2] -= 1;
    if !alarm[2]
    {
        en_xscale_set();
        hspd = 3/4 * image_xscale;
        status &= ~(STILL | PASSTHRU);
        status |= MOVING;
        alarm[3] = alarm[3] + 1 & 3;
        switch alarm[3]
        {
            case 0: alarm[2] = $7B; break;
            case 1: alarm[2] = $41; break;
            case 2: alarm[2] = $B4; break;
            case 3: alarm[2] = $20; break;
        }
        timeline_position = 2;
    }
    break;
   

case 2:
    alarm[2] -= 1;
    if alarm[2]
    {
        if !irandom($1F)
        {
            en_xscale_set();
            hspd = 3/4 * image_xscale;
            if image_xscale != global.image_xscale
            if abs(x - Belmont.x) < $38
            {
                hspd *= -1;
                image_xscale *= -1;
            }
        }
        if x - view_xview < 8
            x = view_xview + 8;
        else
        if x - view_xview > $F8
            x = view_xview + $F8;
    }
    else
    {
        status &= ~MOVING;
        en_xscale_set();
        timeline_position = 3;
        alarm[2] = $28;
    }
    break;
   
   
case 3:
    alarm[2] -= 1;
    if alarm[2]
    {
        var temp; temp = (system.alarm[0] & 2) + 1;
        if temp != palette
        {
            palette = temp;
            if palette == 0
                sprite_index = spr_TwinMummy;
            else
                sprite_index = spr_MummyFlash;
        }
    }
    else
    {
        if palette != 0
        {
            palette = 0;
            sprite_index = spr_TwinMummy;
        }
        alarm[2] = 8;
        timeline_position = 4;
        with spawn_twinwrap(0,8-16*irandom(1))
        {
            hspd = 3/2 * image_xscale;
            vspd = 3/2;
            play_sound(snd_twinwrap);
        }
    }
    break;
   
   
case 4:
    alarm[2] -= 1;
    if !alarm[2]
    {
        en_xscale_set();
        status |= MOVING;
        alarm[3] = alarm[3] + 1 & 3;
        switch alarm[3]
        {
            case 0: alarm[2] = $7B; break;
            case 1: alarm[2] = $41; break;
            case 2: alarm[2] = $B4; break;
            case 3: alarm[2] = $20; break;
        }
        timeline_position = 2;
    }
    break;
}

Mummy Wrap
timeline_index = st_twinwrap
Code: [Select]
switch timeline_position
{
case 0:
    status = MOVING;
    sprite_index = spr_MummyWrap;
    image_speed = 1/8;
    move_sinewave(0);
    timeline_position += 1;
    break;
   
case 1:
    move_sinewave(0);
    break;
}


Frankenstein's Monster
timeline_index = st_themonster
Code: [Select]
en_xscale_set();
switch timeline_position
{
case 0:
    if !(status & PASSTHRU)
    {
        status |= PASSTHRU;
        image_speed = 1/$18;
        sprite_index = spr_Frankenstein;
    }   
    if !(system.status & $F0) //if boss fight
        exit;
    alarm[2] = $78;
    status &= ~PASSTHRU;
    timeline_position += 1;
    break;


case 1:
    alarm[2] -= 1;
    if !alarm[2]
    {
        timeline_position = 2;
        status |= MOVING | STILL;
        hspd = 3/4 * image_xscale;
        alarm[2] = $3C;
        //55 = system.alarm[0] & 3;
    }
    break;
   

case 2:
    alarm[2] -= 1;
    if alarm[2]
        Igor.x = x;
    else
    {
        with Igor
        {
            timeline_position = 1;
            status &= ~PASSTHRU;
            status |= MOVING;
        }
       
        if abs(Belmont.x - x) < $50
            dir = -image_xscale;
        else
            dir = image_xscale;

            timeline_position = 3;
            switch irandom(3)
            {
                case 0: alarm[2] = $3C; break;
                case 1: alarm[2] = $24; break;
                case 2: alarm[2] = $54; break;
                case 3: alarm[2] = $18; break;
            }
            dir = -image_xscale;
            hspd = 3/4 * dir;
    }
    break;
   

case 3:
    alarm[2] -= 1;
    if alarm[2]
    {
        if x - view_xview < $10 || x - view_xview > $EF
        {
            dir = - dir;
            hspd = 3/4 * dir;
        }
    }
    else
    {
        if abs(Belmont.x - x) < $50
            dir *= -1;
        hspd = 3/4 * dir;
        timeline_position = 3;
        switch irandom(3)
        {
            case 0: alarm[2] = $3C; break;
            case 1: alarm[2] = $24; break;
            case 2: alarm[2] = $54; break;
            case 3: alarm[2] = $18; break;
        }
    }
}

Igor
timeline_index = st_igor
Code: [Select]
switch timeline_position
{
case 0:
    if !(status & PASSTHRU)
    {
        status |= PASSTHRU;
        sprite_index = spr_Fleaman
        image_speed = 1/8;
    }
    en_xscale_set();
    hspd = 3/2 * image_xscale;
    vspd = 0;
    break;
   

case 1:
case 2:
    vspd += 1/8;
    if tile_map_read(0,0) //(0,8) //check collision below
    {
        y &= ~7;
        vspd = 0;
        hspd = 0;
        image_index = 1;
        alarm[2] = 8;
        status &= ~MOVING;
        timeline_position += 1;
    }
    if x - view_xview < 9
        x = view_xview + 9;
    else
    if x - view_xview > $F7
        y = view_xview + $F7;
    hspd *= -1;
    image_xscale *= -1;
    if y - view_yview < $30
    {
        y = view_yview + $30;
        vspd = 0;
    }
   
    if timeline_position == 1
    if vspd >= 0
    {
        image_index = 2;
        timeline_position = 2;
        with spawn_fireball(0,0)
        {
            sc_cvbat2();
        }
    }
    break;
   
   
case 3:
    alarm[2] -= 1;
    if alarm[2]
    {
        if y - view_yview < $30
        {
            y = view_yview+$30;
            vspd = 0;
        }
    }
    else
    {
        timeline_position = 1;
        switch irandom(3)
        {
            case 0: vspd = -3; break;
            case 1: vspd = -5; break;
            case 2: vspd = -4; break;
            case 3: vspd = -6; break;
        }
        image_index = 1;
    }
    break;
}


Death
timeline_index = st_cvdeath
Code: [Select]
en_xscale_set();
switch timeline_position
{
case 0:
    status |= STILL;
    status &= ~MOVING;
    if !(system.status & $F0) //if boss fight
        exit;
    alarm[2] = $78;
    timeline_position += 1;
    break;


case 1:
    alarm[2] -= 1;
    if alarm[2] exit;
    sprite_index = spr_Reaper;
    vspd = 5/2;
    status |= MOVING;
    status &= STILL;
    timeline_position = 2;
    break;
   

case 2:
    vspd += 5/256;
    sc_reaper();
    break;
   
   
case 3:
    if !(irandom($1F))
    if abs(x-Belmont.x) < $48
    {
        dir = image_xscale;
        vspd = 2;
        hspd = 5/4 * dir;
        status |= MOVING;
        timeline_position = 4;
        exit;
    }
   
    alarm[2] -= 1;
    if alarm[2] exit;
    vspd = 1+irandom(1);
    dir = irandom(1) - 1 | 1;
    hspd = 3/4 * dir;
    status |= MOVING;
    timeline_position = 4;
    break;
   
   
case 4:
    if x - view_xview < $10
    {
        x = view_xview + $10;
        dir *= -1;
    }
    else
    if x - view_xview > $F0
    {
        x = view_xview + $F0;
        dir *= -1;
    }
    vspd -= 3/128;
    if y - view_yview < $21
    {
        y = view_yview + $21;
        vspd = 0;
    }
    else
        sc_reaper();
    break;

}

Death Subscript
script_id = sc_reaper
Code: [Select]
if tile_map_read(0,0) //(0,$18) //check collision below (i think)
{
    var temp;
    y &= ~7;
    for(temp[2]=3+global.hard_mode; temp[2] > 0; temp[2]-=1)
    with spawn_reapscythe(0,0) //A to D
    {
        temp[0] = Belmont.x - view_xview;
        temp[1] = Belmont.y - view_yview;
        switch temp[2]
        {
            case 1:
                    x = temp[0] + $04;
                    y = temp[1] + $20;
                    break;
            case 2:
                    x = temp[0] + $30;
                    y = temp[1] + $D0;
                    break;
            case 3:
                    x = temp[0] + $A0;
                    y = temp[1] + $18;
                    break;
            case 4:
                    x = temp[0] + $20;
                    y = temp[1] + $B0;
                    break;
        }
        x = (x & $FF) + view_xview;
        y = (y & $FF) + view_yview;
        alarm[2] = $28;
        status &= (MOVING | STILL);
    }
    switch irandom(3)
    {
        case 0: alarm[2] = $90; break;
        case 1: alarm[2] = $5F; break;
        case 2: alarm[2] = $B9; break;
        case 3: alarm[2] = $54; break;
    }
   
    status &= ~MOVING;
    timeline_position = 3;
}

Death's Scythe
timeline_index = st_reapscythe
Requires a step counter.
Code: [Select]
switch timeline_position
{
case 0:
    sprite_index = spr_ReapScythe;
    image_speed = 1/2;
    alarm[2] -= 1;
    if alarm[2]
    {
        status &= ~HIDDEN;
        if system.alarm[0] & 1
            status |= HIDDEN;
    }
    else
    {
        status &= ~HIDDEN;
        timeline_position = 1;
    }
    break;
   

case 3:
    alarm[2] -= 1;
    if alarm[2] break;
case 1:
    var temp; temp[1] = sc_cvbat1(0,0);
    temp[0] = temp[1] & 1;
    temp[1] = temp[1] >> 1;
    temp[1] /= $100;
   
    if temp[0]
    {
        hspd = temp[1] * image_xscale;
        vspd = 14/16;
    }
    else
    {
        vspd = temp[1];
        hspd = 14/16 * image_xscale;
    }
    if alarm[5]
        vspd *= -1;
    status |= MOVING;
    alarm[2] = $78;
    timeline_position = 2;
    break;
   

case 2:
    alarm[2] -= 1;
    if !alarm[2]
    {
        status &= ~MOVING;
        alarm[2] = $20;
        timeline_position = 3;
    }
    break;   
}


Humanoid Dracula
timeline_index = st_bigdbody
The original code was a tad hard to follow, so I'm not sure if this is correct or not. I had to read the original code time after time and time again. Dracula's head is separate from his body, but the body controls the head.

Also, Dracula's code requires a step counter as well.
Code: [Select]
if timeline_position < 14
    en_xscale_set();
   
switch timeline_position
{
case 0:
    status |= STILL;
    status &= ~MOVING;
    if !(system.status & $F0) //if boss fight
        exit;
    alarm[2] = $78;
    timeline_position += 1;
    break;
   
   
case 1:
    alarm[2] -= 1;
    if alarm[2] exit;
    with instance_create(0,0,BigDHead)
        sprite_index = spr_BigDHead;
    sprite_index = spr_BigDBody;
    status |= HIDDEN;
    alarm[2] = $3C;
    timeline_position = 2;
    break;
   

case 2:
    alarm[2] -= 1;
    if !alarm[2]
    {
        status |= MOVING;
        vspd = -1/2;
        timeline_position = 3;
    }
    sc_bigdhead();   
    break;   


case 3:
    //Change $A8 to the height of the floor
    if y - view_yview < $A8
    {
        y = view_yview + $A8;
        alarm[2] = $3C;
        timeline_position = 4;
    }
    sc_bigdhead();
    break;
   
   
case 4:
    alarm[2] -= 1;
    if !alarm[2]
    {
        alarm[2] = $45;
        timeline_position = 5;
    }
    sc_bigdhead();
    break;
   
   
case 5:
    alarm[2] -= 1;
    if alarm[2]
    {
        if system.alarm[0] & 1
            status |= HIDDEN;
        else   
            status &= ~HIDDEN;
    }
    else
    {
        image_index = 1;
        switch irandom(3)
        {
            case 0: alarm[2] = $24; break;
            case 1: alarm[2] = $10; break;
            case 2: alarm[2] = $32; break;
            case 3: alarm[2] = $18; break;
        }
        status &= ~PASSTHRU;
        timeline_position = 6;
    }
    sc_bigdhead();
    break;
   
   
case 6:
    alarm[2] -= 1;
    if !alarm[2]
    {
        image_index = 2;
        timeline_position = 6;
        alarm[2] = $10;
    }
    sc_bigdhead();
    break;
   
   
case 7:
    alarm[2] -= 1;
    if !alarm[2]
    {
        var temp;
        for(temp[1]=0; temp[1]<3; temp[1]+=1)
            with spawn_fireball(0,0) //4 to D
            {
                temp[0] = sc_cvbat1(0,$10-$10*temp[1]);
                sc_cvbat3(temp[0]);
            }
        alarm[2] = $20;
        timeline_position = 8;
    }
    sc_bigdhead();
    break;
   
   
case 8:
    alarm[2] -= 1;
    if !alarm[2]
    {
        timeline_position = 9;
        status |= PASSTHRU;
        alarm[2] = $20;
    }
    sc_bigdhead();
    break;
   
   
case 9:
    alarm[2] -= 1;
    if alarm[2]
    {
        if system.alarm[0] & 1
            BigDHead.status &= ~HIDDEN;
        else
            BigDHead.status |= HIDDEN;
    }
    else
    {
        timeline_position = 10;
        alarm[2] = $4F;
        status |= HIDDEN;
        BigDHead.status |= HIDDEN;
    }
    sc_bigdhead();
    break;
   
   
case 10:
    alarm[2] -= 1;
    if !alarm[2]
    {
        timeline_position = 11;
        alarm[2] = $20;
        var temp; temp[1] = system.alarm[0];
        while 1
        {
            switch temp[1] & 7;
            {
                case 0: temp[0] = $10; break;
                case 1: temp[0] = $F8; break;
                case 2: temp[0] = $80; break;
                case 3: temp[0] = $60; break;
                case 4: temp[0] = $30; break;
                case 5: temp[0] = $D8; break;
                case 6: temp[0] = $60; break;
                case 7: temp[0] = $A8; break;
            }
            x = (Belmont.x - view_xview + temp[0] & $FF) + view_xview;
            if x - view_xview < $14 || x - view_xview > $EB
                temp[1] += 1;
            else
                break;
        }
    }
    break;
   
   
case 11:
    alarm[2] -= 1;
    if alarm[2]
    {
        if system.alarm[0] & 1
        {
            status &= ~HIDDEN;
            BigDHead.status &= ~HIDDEN;
        }
        else
        {
            status |= HIDDEN;
            BigDHead.status |= HIDDEN;
        }
    }
    else
    {
        switch irandom(3)
        {
            case 0: alarm[2] = $24; break;
            case 1: alarm[2] = $10; break;
            case 2: alarm[2] = $32; break;
            case 3: alarm[2] = $18; break;
        }
        status &= ~(PASSTHRU | HIDDEN);
        timeline_position = 6;
    }
    sc_bigdhead();
    break;
   
   
case 13:
    status |= HIDDEN | PASSTHRU;
    with BigDHead
    {
        status |= PASSTHRU;
        image_xscale = -other.image_xscale;
        hspd = 2 * image_xscale;
        vspd = -5;
    }
    alarm[2] = $78;
    timeline_position = 14;
    break;
   
   
case 14:
    alarm[2] -= 1;
    if !alarm[2]
    {
        timeline_index = st_bigdemon;
        timeline_posiiton = 0;
        alarm[2] = $20;
    }
    break;
}

Dracula's Head Subscript
script_id = sc_bigdhead
Code: [Select]
BigDHead.y = y - $1A;
BigDHead.x = x - 6 * image_xscale;
BigDHead.image_xscale = image_xscale;
BigDHead.timeline_position = timeline_position;

Demonoid Dracula
timeline_index = st_bigdemon
Code: [Select]
en_xscale_set();

switch timeline_position
{
case 0:
    alarm[2] -= 1;
    if alarm[2]
    {
        if system.alarm[0] & 1
            BigDHead.status &= ~HIDDEN;
        else
            BigDHead.status |= HIDDEN;
    }
    else
    {
        //change music
        for({var temp; temp=0;} temp < 6; temp += 1;)
        with spawn_bigdflesh(0,0); //spawns 6 chunks of flesh
        {
            switch temp
            {
                case 0:
                        image_xscale = -1;
                        hspd = 45/16;
                        vspd = hspd;
                        break;
                case 1:
                        image_xscale = -1;
                        hspd = 4;
                        vspd = 0;
                        break;
                case 2:
                        image_xscale = -1;
                        hspd = 45/16;
                        vspd = -hspd;
                        break;
                case 3:
                        image_xscale = 1;
                        hspd = -45/16;
                        vspd = -hspd;
                        break;
                case 4:
                        image_xscale = 1;
                        hspd = -4;
                        vspd = 0;
                        break;
                case 5:
                        image_xscale = 1;
                        hspd = -45/16;
                        vspd = hspd;
                        break;
            }
        }
        alarm[2] = $10;
        timeline_position = 1;
        status |= PASSTHRU | HIDDEN;
        with BigDHead
        {
            BigDHead.status |= HIDDEN;
            sprite_index = spr_DemonHead;
        }
    }
    break;
   
   
case 1:
    alarm[2] -= 1;
    if !alarm[2]
    {
        hp = $40;
       
        /*
            Additional code run elsewhere raises or
            lowers the HP bar as so:
           
            if system.alarm[0] & 1
                global.boss_health += sign(hp - global.boss_health);
        */
       
        BigDHead.status &= ~PASSTHRU;
        status &= ~HIDDEN;
        sprite_index = spr_DemonBody;
        image_index = 6;
       
        //Replace $A8 with height of floor
        y = view_yview + $A8;
       
        alarm[2] = $21;
        timeline_position = 2;
        sc_bigdemonhead();
    }
    break;
   
   
case 2:
    alarm[2] -= 1;
    if !alarm[2]
    {
        if system.alarm[0] & 1
            alarm[2] = $55;
        else
            alarm[2] = $7B;
        timeline_position = 3;
        status &= ~PASSTHRU;
    }
    sc_bigdemonhead();
    break;
   
   
case 3:
    alarm[2] -= 1;
    if alarm[2]
    {
        if !(system.alarm[0] & $F)
        {
            if image_xscale != Belmont.image_xscale
            if io_hold & $40 //if player is attacking
            {
                alarm[2] = $10;
                timeline_position = 4;           
            }
        }
    }
    else
    {
        image_index = 1;
        alarm[2] = $10;
        timeline_position = 4;
    }
    sc_bigdemonhead();
    break;
   
   
case 4:
    alarm[2] -= 1;
    if !alarm[2]
    {
        if system.alarm[0] & 1
            vspd = -6;
        else
            vspd = -9/2;
        hspd = 3/4 * image_xscale;
        image_index = 2;
        timeline_position = 5;
    }
    sc_bigdemonhead();
    break;
   

case 5:
    vspd += 3/16;
    var temp; temp = y - view_yview;
    if temp < $20
        vspd = 0;
    if temp < $60
         image_index = 2;
    else
        image_index = 3;
    temp = x - view_xview;
    if temp < $18 || temp > $E7
        hspd *= -1;
    if tile_map_read(0,0) //Check collision below
    {
        vspd = 0;
        y &= ~7;
        image_index = 4;
        alarm[2] = $18;
        timeline_position = 6;
        play_sound(snd_thwomp/*heavy landing*/);
    }
    sc_bigdemonhead();
    break;
   
   
case 6:
    alarm[2] -= 1;
    if !alarm[2]
    {
        alarm[2] = $10;
        image_index = 6;
        timeline_position = 7;
    }
    sc_bigdemonhead();
    break;
   
   
case 7:
    alarm[2] -= 1;
    var temp; temp = abs(x - Belmont.x);
    if temp < $30 || !(temp & 3)
    {
        if system.alarm[0] & 1
            alarm[2] = $55;
        else
            alarm[2] = $7B;
        timeline_position = 3;
    }
    else
    if temp & 3
    {
        if system.alarm[0] & 1
            alarm[2] = $10
        else
            alarm[2] = $28;
        timeline_position = 8;
    }
    sc_bigdemonhead();
    break;
   
   
case 8:
    alarm[2] -= 1;
    if !alarm[2]
    {
        image_index = 5;
        alarm[2] = $10;
        timeline_position = 9;
    }
    sc_bigdemonhead();
    break;
   

case 9:
    alarm[2] -= 1;
    if !alarm[2]
    {
        play_sound(snd_fwoosh/*fwooshy flames*/);
        var temp;
        with BigDHead
        for(temp[1]=0; temp[1]<3; temp[1]+=1)
        with spawn_fireball(0,0)
        {
            temp[0] = sc_cvbat1(0,$10-$10*temp[1]);
            sc_cvbat3(temp[0]);
        }
        alarm[2] = $10;
        timeline_position = 10;
    }
    sc_bigdemonhead();
    break;


case 10:
    alarm[2] -= 1;
    if !alarm[2]
    {
        image_index = 6;
        //Change the $A8 to the floor height
        y = view_yview + $A8;
        alarm[2] = $21;
        status |= PASSTHRU;
        timeline_position = 2;
    }
    sc_bigdemonhead();
    break;
}

Demonoid Head Subscript
script_id = sc_bigdemonhead
Code: [Select]
BigDHead.image_xscale = image_xscale;
BigDHead.y = y - $20;
BigDHead.x = x + 8 * image_xscale;
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline TheouAegis

  • Amateur Auteur of GMvania
  • Master Hunter
  • *****
  • Posts: 1860
  • Gender: Male
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. The Great Defender will always defend the object of his or her fandom. Hack Master makes creations out of CV parts. (S)he makes Dr. Frankenstein proud.
    • GMvania Developer's Blog
    • Awards
  • Likes:
Re: Incorporate that old-school feel into your fan games
« Reply #28 on: November 07, 2016, 01:53:02 PM »
0
Just realized I never posted the CV1 enemies other than the bosses. I'll try to get around to that this week. :o
Your mom has had more floppies put in her than a Commodore 64!


Follow my lack of progress on my game at my blog:
http://gmvania.blogspot.com

Offline Inccubus

  • Wannabe Great Old One
  • Master Hunter
  • *****
  • Posts: 3265
  • Gender: Male
  • Warrior
  • Awards The Retro Gamer: Has a heated passion for the oldschool VG Titles. SuperOld Dungeonite: Members who have been around since the oldOLD days. Permanent Resident: Seems to always be around to post/reply.
    • Awards
  • Favorite Game: Vampire Killer (MSX)
  • Likes:
Re: Incorporate that old-school feel into your fan games
« Reply #29 on: November 18, 2016, 08:11:35 AM »
0
That would be awesome if you could do that.
"Stuff and things."

Tags: code summary disclaimer