persona ui template
This code is over 6 months old. The code may have expired and might no longer function.
boilerplate code for creating persona-style ui in overpy.
overpy source is in the snippet.
most of the work is in filling in the arrays and deciding on a formula for the menu items.
features a linear menu and wheel menu (though the wheel doesn't loop back on itself nicely)
if you don't have space for a dummy you will need to shift the menu scrolling to keys that are not the movement keys. if you use the player as the model it will do the walking animation and it'll look bad. you can't root the player or you can't detect its throttle.
how to use
- populate the lists of menu items and their corresponding icon lists. you can add as many as you want.
- take the following positions as local vectors relative to the model player. order is important, see the following example.
-
menuCamPos
is the position of the camera in each menu screen. -
menuLookPos
is where the camera looks at in each screen, and where the sparkle effect plays on selection. -
menuStripeStarts
andmenuStripeEnds
are the start/end positions of the beam effects for each menu screen. 1 beam will have its direction reversed for style. -
menuStripeOffsets
is the offset for the 2nd beam relative to the first for each menu screen. - add the in world text generation in the
create menu hud
rule. you'll need to write a formula (examples are in the code) that will handle the positions of the text objects. - if you added a new menu, make sure to update
menuMaxes
- this indicates how many menu items you can scroll through before looping back to the start
order example (icon lists are omitted for brevity):
`chickenList = ["wing", "drumstick", "foot", "breast", "soul"]
drinkList = ["fanter", "pilk", "battery acid"]
menuMainList = ["chicken", "drinks"]
menuCamPos = [null, Vector.FORWARD, Vector.UP, Vector.LEFT]
menuLookPos = [null, Vector.BACKWARD, Vector.DOWN, Vector.RIGHT]
menuMaxes = [null, len(menuMainList), len(chickenList), len(drinkList)]
enum MENU:
OFF,
MAIN,
CHICKEN,
DRINK`
this will produce a main menu leading to the chicken and drinks menus.
the main menu's camera will face the front of the character.
the chicken menu's camera will look down towards the character.
the drinks menu's camera will face the left of the character.
the null
in the 3 last lists are for the menuState
of 0 - MENU.OFF
in the enum.
Controls
Snippet
Loading...