[Python] Small basic program error..PLZ HELP

python

#1

hi there i have been doing small basic for a long time now and right now i have been coding a project that simulates a board game called hero cliks…i dont know the rules but ive seen one…anywho i cant get one part of the code working…so if you could plz copy and paste this into smallbasic and try to get it to work for you.,.,

HERE IS THE CODE: THN538

OR:

TextWindow.WriteLine("PLAYER NAME ONE")
a = TextWindow.Read()
TextWindow.WriteLine("PLAYER NAME TWO")
B = TextWindow.Read()
TextWindow.WriteLine("PLAYER ONE HEALTH")
P1HEALTH = TextWindow.Read()
TextWindow.WriteLine("PLAYER TWO HEALTH")
P2HEALTH = TextWindow.Read()
TextWindow.WriteLine("PLAYER ONE DEF")
P1_def = TextWindow.Read()
TextWindow.WriteLine("PLAYER TWO DEF")
P2_def = TextWindow.Read()
GraphicsWindow.Show()
GraphicsWindow.Width = 500
GraphicsWindow.Height = 200
GraphicsWindow.BackgroundColor = "white"



'player 1 info
GraphicsWindow.DrawText(50, 50, a)
GraphicsWindow.DrawText(90, 50, P1HEALTH)
GraphicsWindow.DrawText(130, 50, P1_def)
'player 2 info
GraphicsWindow.DrawText(50, 30, B)
GraphicsWindow.DrawText(90, 30, P2HEALTH)
GraphicsWindow.DrawText(130, 30, P1_def)
GraphicsWindow.BackgroundColor = "white"


P1_attack = 0
P2_attack = 0
turn = 0

If turn = 0 Then
While P2_def > 0 
 TextWindow.WriteLine("How much damage to" + B)
 P1_attack = TextWindow.Read()
 P2_def - P1_attack
 turn = 1
 EndWhile
 If P2_def = 0 then
 TextWindow.WriteLine("How much damage to" + B)
 P1_attack = TextWindow.Read()
 P2HEALTH - P1_attack
 turn = 1
EndIf
EndIf
 
GraphicsWindow.Clear()
'player 1 info
GraphicsWindow.DrawText(50, 50, a)
GraphicsWindow.DrawText(90, 50, P1HEALTH)
'player 2 info
GraphicsWindow.DrawText(50, 30, B)
GraphicsWindow.DrawText(90, 30, P2HEALTH)
GraphicsWindow.BackgroundColor = "white"  
  If turn = 1 Then
 TextWindow.WriteLine("How much damage to" + a)
 P2_attack = TextWindow.Read()
 P1HEALTH = P1HEALTH - P2_attack
 turn = 0
EndIf
 GraphicsWindow.Clear()
'player 1 info
GraphicsWindow.DrawText(50, 50, a)
GraphicsWindow.DrawText(90, 50, P1HEALTH)
GraphicsWindow.DrawText(130, 50, P1_def)
'player 2 info
GraphicsWindow.DrawText(50, 30, B)
GraphicsWindow.DrawText(90, 30, P2HEALTH)
GraphicsWindow.DrawText(130, 30, P1_def)
GraphicsWindow.BackgroundColor = "white"
If turn = 0 Then
  TextWindow.WriteLine("How much damage to" + B)
 P1_attack = TextWindow.Read()
 P2HEALTH = P2HEALTH - P1_attack
 turn = 1
EndIf
  GraphicsWindow.Clear()
'player 1 info
GraphicsWindow.DrawText(50, 50, a)
GraphicsWindow.DrawText(90, 50, P1HEALTH)
GraphicsWindow.DrawText(130, 50, P1_def)
'player 2 info
GraphicsWindow.DrawText(50, 30, B)
GraphicsWindow.DrawText(90, 30, P2HEALTH)
GraphicsWindow.DrawText(130, 30, P1_def)
GraphicsWindow.BackgroundColor = "white"
If P1HEALTH = 0 Or P2HEALTH = 0 Then
  TextWindow.WriteLine("game over")
  Program.End()
EndIf
   If turn = 1 Then
 TextWindow.WriteLine("How much damage to" + a)
 P2_attack = TextWindow.Read()
 P1HEALTH = P1HEALTH - P2_attack
 turn = 0
EndIf
 GraphicsWindow.Clear()
'player 1 info
GraphicsWindow.DrawText(50, 50, a)
GraphicsWindow.DrawText(90, 50, P1HEALTH)
'player 2 info
GraphicsWindow.DrawText(50, 30, B)
GraphicsWindow.DrawText(90, 30, P2HEALTH)
GraphicsWindow.BackgroundColor = "white"
If P1HEALTH = 0 Or P2HEALTH = 0 Then
  TextWindow.WriteLine("game over")
  Program.End()
EndIf

#3

please change the tagging on this thread, your code is written in Python - so people who are learning it can’t really help you. If you want to gain any help, change the tag to the correct language so it lands on the right people that does the same language as you

Hope you get it fixed :smiley: