Should have something for you to try shortly. Working out a slightly different solution to your problem, it will be all BP, since I know thats the solution you’re looking for. Just making sure I am correct: You’re making a perpetual runner, that needs to be able to move to the right constantly, but also able to jump and slide based on keypress commands?
I’ll do a quick mockup using some generic assets, so you can see if its what you’re thinking. If so, you should be able to duplicate the solution easily. I’ll provide some basic instructions, just in case.
Edit: Answer posted. It works for me without issue.
I really REALLY appreciate the work you’re going through to help me. Ya that’s correct. It will eventually be for the App store for apple products. But ya, really thank you.
So I went ahead and threw together a basic 2d side scroller, using the generic assets that were provided for the livestream to get a 2d character to play with. I built out the basics of a state machine, that calls the different sprite animations based on the current state, and also updates that state based on input from the player. This could be changed later, based on whatever you were looking to do with it. I also have the game set to check the state every tick, so that it can call the animation update as necessary. Additionally, the update ensures that if the game is started, the forward movement proceeds non-stop. You can jump and slide, but will always return to the default run state/animation.
You’ll need to create two variables and one enum. The enum will be Char_States and the variables are an enum variable that is linked to that enum (Which I called CharState) and a boolean variable of GameStarted.
In the images, you’ll see each piece of the BP, built in the 2DSideScrollerCharacter BP, just for clarity.
(The PrintString calls are just for testing purposes and can be removed. I’m sure there are cleaner ways to do this, but this is what I thought of off the top of my head, and it works, so there it is.)
Thank you so much for all the time you’ve spent. I will let you know when I’m done.
By done, I mean done with trying your suggestion.
No problem. Hopefully it does what you need it to! Good Luck!
I’m sorry, how do I make an “enum”?
When you’re in the content browser, right click, select Blueprints, then select Enumeration. In the enumeration, you’ll add your “states” that you intend to use when you add the switch later in the BP. Be sure to save the enum as a name you’ll recognize for when you set up the "switch on (whatever you named it).
Also, dont forget to create a enum variable in the BP as well, that links to the enum you just created. Additionally, make its name something recognizable also, so when you drop the getters and setters you’ll know what it’s referencing easier.
Alright, and how do I link the variable to the enum?
When you create the variable, it’ll default to boolean. Click the red pill and select the enum option, then click the enum you created. That’ll make a variable linked to your enum. Then just click on the name and set it to whatever you want, rather than NewVar_0 or whatever it creates it as.
Okay, so my “update animation” for the third photo is all blue rather than red, is that okay?
If you’re still having trouble, i’ll do a little tutorial video for it and go through how I set it up. Would take me a few hours to get that posted.
wrong node. The red one is a “custom event” the blue one points to that event.
Essentially, the red one is what is called by the blue nodes. When they are executed, they trigger the event, which is where the red one fires off. So you’ll need to have the red one to link to your switch to handle the animation switching, and then the blue ones that link to the machine that runs each tick, telling it when to run the red update animation node.
Alright, well we’ll see how this ends up, I’m getting close.
Alright. How do I do a custom one?
right click anywhere in the BP, select events, then select “add custom event”. can also do a search for “add custom event”, that works too.
Alright! I’m done. Haven’t tested it out yet, would you mind looking over these screenshots real quick to make sure I got everything correct?alt text