I've started with Gradius Gaiden sprites as they have lots of details and are still pixel based.
My 8 way movement GML script also stops you flying off the edges of the screen.
This script has the ship flying at one speed only (5 pixels).
// 8 Way movement script
if keyboard_check(vk_up)
{
if y>15
{
y-=5;
}
}
}if keyboard_check(vk_down)
{
if y<room_height-15
{
y+=5;
}
}
if keyboard_check(vk_left)
{
if x>30
{
x-=5;
}
}
if keyboard_check(vk_right)
{
if x<room_width-40
{
x+=5;
}
}
Vic Viper is made up of 9 frames, frame 4 being the flying along frame
// Up and Down animation
image_index=4; // First frame displayed
image_speed=0; // Animation Speed
This script pans the ship up and down when the Up or Down keys are pressed.
// Up and Down animation
if keyboard_check(vk_down)
{
if image_index<8 image_index+=1/4;
}
else if image_index>4 image_index-=1/4;
if keyboard_check(vk_up)
{
if image_index>0 image_index-=1/4;
}
else if image_index<4 image_index+=1/4;
Vic Viper | Up Frames | Down Frames | Flying Frames | Flame | Ships Light Frames |
---|---|---|---|---|---|
|
4 | 4 | 1 | 4 | 5 |
This script cycles the light colours through the 8 frames and also pans the lights animation with the ship when you fly up and down.
// Up and down animation
image_index=4; // First frame displayed
image_speed=0; // Animation Speed
// Ships lights colour cycle variable
var_light=1;
// Ships lights RGB codes
var_light1=make_color_rgb(49,0,0); // 01 - brown
var_light2=make_color_rgb(132,0,0); // 02 - dark red
var_light3=make_color_rgb(222,74,0); // 03 - dark orange
var_light4=make_color_rgb(255,123,0); // 04 - orange
var_light5=make_color_rgb(255,181,0); // 05 - yellow
var_light6=make_color_rgb(255,123,0); // 06 - orange
var_light7=make_color_rgb(222,74,0); // 07 - dark orange
var_light8=make_color_rgb(132,0,0); // 08 - dark red
// Sets the light on top of vv sprite
obj_vv_light.x=obj_vv.x-0;
obj_vv_light.y=obj_vv.y-0;
// Ships light script
if var_light=1
{
image_blend=var_light1;
var_light+=1;
}
else if var_light=2
{
image_blend=var_light2;
var_light+=1;
}
else if var_light=3
{
image_blend=var_light3;
var_light+=1;
}
else if var_light=4
{
image_blend=var_light4;
var_light+=1;
}
else if var_light=5
{
image_blend=var_light5;
var_light+=1;
}
else if var_light=6
{
image_blend=var_light6;
var_light+=1;
}
else if var_light=7
{
image_blend=var_light7;
var_light+=1;
}
else if var_light=8
{
image_blend=var_light8;
var_light-=7;
}
// Up and Down light animation
if keyboard_check(vk_down)
{
if image_index<8 image_index+=1/4;
}
else if image_index>4 image_index-=1/4;
if keyboard_check(vk_up)
{
if image_index>0 image_index-=1/4;
}
else if image_index<4 image_index+=1/4;
The flame has four frames of animation and should be at the back of the ship.
// Flame animation speed of 0.7 frames per second
image_index=0;
image_speed=0.7;
// Sets the flame to the back of the ship
obj_vv_flame.x=obj_vv.x-31; // Sets the flame 31 pixels behind the vv sprite
obj_vv_flame.y=obj_vv.y+0;
Working but not quite happy with it.
Not yet implemented