Scrolling background (no parallax) in top down shooter

morcibamorciba Posts: 2Member

Hi everyone. I'm new in Godot so be patient please.

I try to make scrolling background in top down shooter. It should look like scrolling land in RiverRaid game.

I made a Scene: Area2D -> Sprite -> StaticBody2D -> CollisionPolygon2D
To scroll it down i'am using: set_pos(Vector2(0, get_pos().y + speed * delta))

It works, but I want to ask if there is better way to accomplish it.


  • RossRoss Posts: 199Member
    edited November 2016 Answer ✓

    If it's just a background you only need a Sprite. Area2D and StaticBody2D are for collisions.

    You can also use translate(vect) or global_translate(vect) instead of set_pos(get_pos() + vect).

  • morcibamorciba Posts: 2Member

    Thanks. I'll try it. Is it more efficient?

  • RossRoss Posts: 199Member
    edited November 2016 Answer ✓

    It's probably a teeny tiny bit more efficient to use translate(). Anything you can use the built-in (C++) functions for will be much faster than doing it yourself in GDScript. But honestly this is trivial. Maybe if you did a few hundred of these it would matter. It's just a little faster to write and easier to read.

Sign In or Register to comment.