Castlevania Dungeon Forums

Off Topic => Off Topic => Topic started by: TheouAegis on May 25, 2013, 09:12:52 PM

Title: "8bit" Cherry Blossoms Script(s) for Game Maker
Post by: TheouAegis on May 25, 2013, 09:12:52 PM
I posted this on my blog last night because the forums were down. No one's looked at the blog yet, so I'll post this here. It's unrelated to Castlevania, but you could incorporate it into a Castlevania game if you want. It's VERY EASY to modify (assuming you're using Game Maker). It's also not too confusing. Yes Esco and Inccubus, I use alarms instead of custom variables, but there are only three used and in this situation it doesn't really matter -- there are no other variables needed. You'll be happy to know I used "var X" in the Room Creation Code. Furthermore, no arguments were abused in the making of this script. It's not my own script entirely. It comes from the FC/NES game "Sakigake! Otokojuku". It was a simple (well, simple enough for me to crack it in eight hours) code that yielded what I thought was a nice effect. Remember, if you're using GM:Studio, import the GMK in order to use it. I don't think there were any obsolete commands used.

https://www.dropbox.com/s/w3haz3crml5g7ee/sakurabana.gmk (https://www.dropbox.com/s/w3haz3crml5g7ee/sakurabana.gmk)

Famicom game Sakigake!! Otokojuku 男塾 ファミコン動画 (http://www.youtube.com/watch?v=LqoBnm-5JkU#)
Title: Re: "8bit" Cherry Blossoms Script(s) for Game Maker
Post by: TheouAegis on May 26, 2013, 01:19:30 PM
Okay, I realize some of you fan game designers don't use Game Maker, so I'll share the code too.


Code: [Select]
#define sakura_start
variable0 = variable3;
variable1 = variable0 << 4;
variable2 = 2;
switch variable0 //a switch is like a bunch of IFs
{
    case 0: x = $30; break;
    case 1: x = $F0; break;
    case 2: x = $50; break;
    case 3: x = $D0; break;
    case 4: x = $70; break;
    case 5: x = $B0; break;
    case 6: x = $90; break;
    case 7: x = $E0; break;
}
y = 0;
//If a view port is used, the coordinates need to be adjusted
if view_enabled
{
    x += view_xview;
    y = view_yview;
}
visible = 1;

This next code gets called every step.
Code: [Select]
#define sakura_fall
//The first part deals with a view port being used, otherwise it uses the other part.
if view_enabled
{
    if x<view_xview || x>view_xview+view_wview
        visible = 0;
    if y<view_yview || y>view_yview+$F0
        visible = 0;
}
else
{
    if x<0 || x>room_width
        visible = 0;
    if y<0 || y>$F0
        visible = 0;
}
//The $F0 should be changed based on the height of your rooms.
if sprite_index == -1 //Check if no sprite is assigned to the petal.
{
    variable1 -= 1;
    if variable1 > 0
        exit;
    sprite_index = spr_sakura;
}
else
{
    if !visible
        sakura_start();
    variable2 -= 1;
    if !variable2
    {
        variable0 = variable0 + 1 & 7;
        switch variable0
        {
            case 0: case 6: variable2 = 2; break;
            case 1: case 2: case 4: case 5: case 7: variable = 4; break;
            case 3: variable2 = 8; break;
        }
    }
    image_index = (variable0 & 3)+1>>2;
    switch variable0
    {
        case 0: case 1: case 7: hspeed = -2; break;
        case 2: case 6: hspeed = -1; break;
        case 3: case 5: hspeed = 0; break;
        case 4: hspeed = 1; break;
    }
    vspeed = 1 + (variable0 > 0);
}

The petals need to be created and run sakura_start using the following.
Code: [Select]
var X;
for (X = 0; X<8; X+=1)
with instance_create(0,0,obj_sakura)
{
    variable3 = X;
    sakura_start();
}