News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Fight simulation...

Started by Pagan Slim, June 11, 2010, 09:53:46 AM

Previous topic - Next topic

Pagan Slim

 After 5 hours of scratching around with Play Basic this is what my fight routine was reduced to.  The first two were too complicated to debug.  At least this works.  I will have to build on this to learn proper programing.  I plan to write a game someday that simulates a demolition derby.  Trash your opponents cars before they trash yours. Hope I'm doing this forum thing right.  I know there are flaws and imperfections but I just wanted to post something.  I haven't posted in years.

PlayBASIC Code: [Select]
CLS
HITPOINTS = RND (20)
ARMOR = RNDRANGE (3,18)
WEAPON = RNDRANGE (2,12)
ATTACK = ((HITPOINTS + ARMOR) /2) - WEAPON
PRINT "HIT POINTS " + Str$(HITPOINTS)
PRINT "ARMOR " + Str$(ARMOR)
PRINT "WEAPON " + Str$(WEAPON)
PRINT "ATTACK " + Str$(ATTACK)
PRINT" "
PRINT "ATTACK = ((HITPOINTS + ARMOR) /2) - WEAPON"
PRINT " "
If ATTACK > 0
Print "YOUR HEALTH IS " + Str$(HEALTH) + " YOU LiVe."
Else
Print "YOU is dEaD... DOA"
sync
WAIT 2000
EndIf

SYNC
WAITKEY