How do i make the soulbox like in undertale/deltarune?

How do I…

I wish to make a soul box like in undertale and deltarune for a fan game im working on, but the soul won’t stay within the box. and also, if you can help how can i make the TP bar?

What is the expected result

The soul stays in the battle box

What is the actual result

the soul can escape freely and i can’t force it to stay within its boundaries.

like this image:

Change position of your soul on X add TimeDelta() * 40
Check if its too fast or too slow and adjust that 40 to match how fast soul should move

After you have that magic number
Make Variable call it Speed and set that variable to TimeDelta * your number
And now make 4 events
1
Condition
Left key is pressed

Action
Change X position of soul SET TO max(Soul.X() - Speed, Box.X())

2

Condition
Right key is pressed

Action
Change X position of soul SET TO min(Soul.X() + Soul.Width() + Speed, Box.BoundingBoxRight())

3
Condition
Up key is pressed

Action
Change Y position of soul SET TO max(Soul.Y() - Speed, Box.Y())

4

Condition
Down key is pressed

Action
Change Y position of soul SET TO min(Soul.Y() + Soul.Height() + Speed, Box.BoundingBoxBottom())

hello!

use seperate objects to make the player collide with a wall

for the mp bar (or whatever the stat)… simply set the MP bar height to the variable mp.

image
MP is the scene variable for the stat. MP_bar is the sprite that represent the MP stat

you can also add a coefficient to make the bar bigger:

image
the 5 is a coefficient: for each unit of the stat… the bar will be 5 pixel higher.