I've managed to get the menu working like I wanted it to. Thanks everyone!

On Thu, Jun 3, 2010 at 2:32 PM, Jake Bolton <ninmonk...@gmail.com> wrote:

> Yes.
>
> You have currently selected unit on menu click.
> Clicking "attack" let's you select a target.
> Save / store these now.
>  DoAttack( unitCur, unitSelected )
>
>  might be easier to send an event.
>
> Pseudo:   # event type as string
>  # then keyword list, args can be different between types.
>  send_event( type="attack",
>      attacker=curSelectedUnit() , target=clickedUnit(), weapon="primary" )
>
> Another option is define menu , set function reference:
>
> # func Menu.additem=
> Class Menu()
>  AddItem( desc, func )
>
> # didn't use target as args, keeping logic outside menu
> M.addItem( "attack" , game.handleAttack() )
>
> # game class containing units. Def func=
> Game.handleAttack( self )
>  Attacker= self.curUnit()
>  Defender=self.selectedUnit()
>  self.damage(defender)
>
> Monkey
>
> On Jun 2, 2010, at 9:24 AM, B W <stabbingfin...@gmail.com> wrote:
>
> > In my mind, the player has to select which unit to perform an action on.
> That target would be stored as state info in your game engine. Then your
> attack() callback simply chooses the attack action, and the game engine has
> the info it needs to execute the turn: player->attacking->target.
> >
> > Gumm
>

Reply via email to