Author Topic: Ship shadow for shooter demo  (Read 356 times)

SaturnTeam

  • Jr. Member
  • **
  • Posts: 69
  • Karma: +5/-0
    • View Profile
    • Saturn Team
Ship shadow for shooter demo
« on: July 06, 2018, 12:39:32 am »
I wanted to share how to set up the shadow for the main ship in the shooter demo. You'll go under draw_ship in your main C file and enter in the following code under the code that's already there:

Code: [Select]
    // SHIP SHADOW
    jo_sprite_enable_shadow_filter();
    jo_sprite_change_sprite_scale(-2.5);
    if (ship.move == RIGHT)
        jo_sprite_enable_horizontal_flip();
    jo_sprite_draw3D(ship.reverse_animation ? jo_get_anim_sprite_reverse(ship.anim_id) : jo_get_anim_sprite(ship.anim_id), ship.x +5, ship.y -25, 800);
    if (ship.move == RIGHT)
        jo_sprite_disable_horizontal_flip();
    jo_sprite_restore_sprite_scale();
    jo_sprite_disable_shadow_filter();

So I've set the trailing shadow scale to 2.5x less than the actual ship size, in order to present the appearance of distance. At the ship's coordinates (ship.x and ship.y), I've shifted the shadow so it is visible, due to not being directly underneath the ship. You'll have to change the numbers based on your specific game. The Z coordinate of 800 is lower than the coordinate for the ship. This technique can be applied to other craft, too.
« Last Edit: July 06, 2018, 12:41:19 am by SaturnTeam »
Founder of Saturn Team

 

Sitemap 1 2 3 4 5 6 7 8 9 10 
SMF spam blocked by CleanTalk