There were only a few things that needed sorting out...
1 - you were mirroring the HUD, not Simon
2 - You were trying to increase/decrease an integer variable by 0.5
3 - You didn't set the current bitmap back to 0 after loading your bitmap, meaning that everything was being drawn to bitmap 2, instead of bitmap 0 (the display).
Here's the fixed code
remstart
************ Castlevania X Technology Test: ************
HUD and Sprites
By Justin O'Conner
********************************************************
This program combines the features of the HUD test with a SCV4 Simon
and some of his moves (only the basics here, sorry).
Controls:
I'm thinking of coding in support for a gamepad in this one, but with a
keyboard they are
Arrow keys: move Simon
Z : Attack with whip
X : Jump
This test uses a lot of the code from the HUD test.
remend
rem Load resources
load bitmap "screen1.bmp", 0
load bitmap "HUD.bmp", 1
get image 1, 0,0,639,64
load bitmap "simon_base.bmp", 2
get image 2,0,0,72,138
set current bitmap 0
rem Variables
score = 0
playerhp = 16
enemyhp = 16
level = 1
screen = 1
crystal = 0
continue = 3
simonxpos = 10
simonypos = 200
facing$ = "right"
rem Main loop
do
gosub _DisplayHUD
gosub _Control
gosub _Displaysimon
loop
_DisplayHUD:
ink rgb(175,175,175), rgb(0,0,0)
sprite 1, 0,0,1
rem Begin drawing elements of the HUD
text 0, 400, "Mouse X: " + str$(mousex())
text 0, 425, "Mouse Y: " + str$(mousey())
rem Score
text 130,15, str$(score)
rem Crystals
text 411,50,str$(crystal)
rem Level and Screen
text 540,17,str$(level)
text 590,17,str$(screen)
rem Continues
text 560,47,str$(continue)
rem Draw the box containing the bar for the player
ink rgb(255,0,0), rgb(0,0,0)
line 130,30,130,45
line 130,30,280,30
line 130,45,280,45
line 280,30,280,45
box 130,30,playerhp * 17.5,45
rem Draw the box containing the bar for the enemy
ink rgb(200,100,10), rgb(0,0,0)
line 130,50,130,60
line 130,50,280,50
line 130,60,280,60
line 280,50,280,60
box 130,50,enemyhp * 17.5,60
return
_Control:
if leftkey() = 1
simonxpos = simonxpos - 1
if simonxpos < 1 then simonxpos = 1
if facing$ = "right"
mirror sprite 2
facing$ = "left"
endif
endif
if rightkey() = 1
simonxpos = simonxpos + 1
if simonxpos > 640 then simonxpos = 640
if facing$ = "left"
mirror sprite 2
facing$ = "right"
endif
endif
return
_Displaysimon:
sprite 2,simonxpos,simonypos, 2
return