Quote: "One method I set up is using sprites for a variety of onscreen menus; one in each corner of the display. Using the collision method, whenever the cursor sprite collides with another sprite, I set a string variable to identify the sprite object (menu item) collided with. Then, in the viewport.click event, I have a Select Case <string variable> statement determine what code to execute based upon the item collided with"
.
Yeah this is a good method, its something like what I often use. I work alot with network operation flags (powers of 2 or hex etc) so I tend to use IF and Else If to see if a single variable contains more than one instruction, to keep network packets small:
run = 1 : jump = 2 : turnleft = 4
action = run Or jump Or turnleft
If (action and run) andalso (action and jump)
Move(RunningSpeed * MidAirMovementReduction)
If action and turnleft
TurnLimb( id, 0, -0.1)
elseif action and turnright
TurnLimb( id, 0, 0.1)
endif
elseif action and run
Move(RunningSpeed)
If action and turnleft
TurnObjectLeft( id, 1)
elseif action and turnright
TurnObjectRight( id, 1)
endif
endif
Quote: "
I am going to be making small rpg example soon and I am will use the 2d interface for menus. Once I'm done I'll post all the code. Perhaps that will help you out."
Cool thanks. I still use 2d commands for a lot of the interface. I have a fully working 2d command based GUI, equipped with bitmap fonts, windows, buttons and animations. I just don't use it for the menus and lists, as it caused too much of a slow down; perhaps because of the quantity commands (200+) and the fact that I have to create loops to check if the menu needed to be updated, drawn and refreshed.
I'm just not in the mood to make it work efficiently; perhaps I am lazy or perhaps other areas of the game deserve more of my time. I started to use WPF based lists, menus and stackpanels so I do not need to reinvent the wheel, the frame rate does not drop, I could label UI elements easily, text boxes have selection copy and paste and I was given lots of ready made commands and events; leaving me more time for modelling and animation. But, still, the disadvantage is security and keyboard focus.
Still searching for a solution; but it seams I will just have to create two keyboard input checks per game action; then run a check during my keyup/keydown event in the base interface class. It's a good thing I bothered to derive all my UI elements from the same class, otherwise the situation would have been worse.