Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / how do I proceed with program only if condition is fulfilled?

Author
Message
filya
18
Years of Service
User Offline
Joined: 23rd Aug 2006
Location: USA
Posted: 17th Mar 2007 23:52 Edited at: 18th Mar 2007 05:33
I know this sounds too stupid, but it's not working out for me.

I am making an turn-based strategy game where I select weapons and click 'Go' each turn to attack my enemy.

My main program is just full of 'gosub's for each step I perform (such as initialize_map, initialize_buildings etc)

Now when I come to the 'input_plr' subroutine, I need the player to click on a weapon of choice and then click 'Go'. Unless he does both of these, the program should not proceed.

I tried placing this subroutine in a while-do and repeat-until loop, but then I get nothing displayed on my screen even if I use sync in that loop.

Any help here?

I could post my whole program here if needed (as this is only for practice purpose) but you dont want to be going through a 500 line program for this I guess.

Thank you for your help!

-filya


edit: ok, here is the design of my program



-- game dev is fun...but taking up too much time --
zeddex2
17
Years of Service
User Offline
Joined: 4th Mar 2007
Location:
Posted: 18th Mar 2007 01:41
I think just send the sub routine and it will be ok.

But if you want to make that you need If statment

like

if the player chose the weapon
weaOk = 1
endif

if the player press Go
Go = 1
endif



if Go = 1 or weaOk = 1
if weaOk = 1
if Go = 1
the program continu
endif
else
you didnt chose the weapon
endif

If you can, I can!
filya
18
Years of Service
User Offline
Joined: 23rd Aug 2006
Location: USA
Posted: 18th Mar 2007 03:52
thanks for this. I do understand the logic, but problem lies where you have written


in your code.

Since the weapon was not chosen, the program should force the player to choose a weapon and not proceed ahead.

In your code, the program would proceed ahead.

-- game dev is fun...but taking up too much time --

Login to post a reply

Server time is: 2024-09-25 19:22:07
Your offset time is: 2024-09-25 19:22:07