How to Create an Active Title Screen?

ZingZing Posts: 45Member

I want an animation of a level from my game to play on the title screen. I want something similar to Super Mario Bros 3's title screen:
Is there a way of animating this without specifying every single movement? Could I record my inputs while playing then give those inputs to an AnimationPlayer node?
I do not want to record an MP4 to play in the background - that would be a new level of lazy.


Tags :

Answers

  • cyberealitycybereality Posts: 927Moderator

    Yes, you would probably want to record yourself playing. At the basic level, you can place code in "_input()" which will record the keyboard events into a file and then save this and play it back later. I've done this before in other engines, and is a valid option.

  • ZingZing Posts: 45Member

    @cybereality What methods record key input? Looking at the docs I don't see anything.

  • SIsilicon28SIsilicon28 Posts: 715Moderator

    You would have to figure out that sort of system yourself. At the base level you'd have to read the input through _input and write it into a file in anyway you choose to. Then you can read it later for your game to use.

  • cyberealitycybereality Posts: 927Moderator

    No not, in the API. You would write it yourself. My idea would be to use an Array to store a complex type (can be a Dictionary or some custom type you create). You'd need to store a time stamp, and then the relevant info from the event. Most likely you'll want to create an enum to store the different actions (PLAYER_JUMP, PLAYER_MOVE_LEFT, etc.). Then on playback check if the current elapsed time is greater than the timestamp saved, and if so, play the event.

    If you base your game on signals, you can even fire the same signals as the real game during playback, it would just be like the real game code only the system would be playing itself, not based on keyboard input. Many games have used this method, like in racing games. I know Wipeout on PSP specifically used this even for the enemy AI while you played the single player. The enemy ships were "played" by fake controllers, there was no difference between you playing and the CPU playing (at least in terms of the car logic).

  • ZingZing Posts: 45Member

    Huh, that sounds like a good solution, I'll try to get this working over the weekend, thanks.

  • ZingZing Posts: 45Member

    Would the demo code be written in a separate script of a different node, as part of the player or part of the root node of the scene?

  • ZingZing Posts: 45Member
    edited May 12

    All of my movement commands (jump(state), move(state, dir)) require the state variable from _integrate_forces. How can I get around this?

  • TwistedTwiglegTwistedTwigleg Posts: 2,666Admin

    What parts of the state variable do you need from _integrate_forces? Maybe you can just store/save the parts you need to a file along with the input.

  • ZingZing Posts: 45Member

    I need the state variable to control linear_velocity and angular_velocity.

  • TwistedTwiglegTwistedTwigleg Posts: 2,666Admin

    Hmm, I think I see the issue now. You might be able to store the linear_velocity and the angular_velocity, but you'll also need a way to apply it... I'm not quite sure how to achieve this though, but I've only done a little bit of 2D work with Godot.

  • ZingZing Posts: 45Member

    I'm going to go back to this later, my game needs more important things to be done.

Sign In or Register to comment.