Post by DeathRaid on Nov 3, 2016 19:25:54 GMT -5
so after bouncing around from programing languages to programing languages i just started to stick to basic4gl and i have learn a lot and its alot of fun im understanding a lot basic4gl great to start with but i ran into a bit of trouble had a game i was thinking of im calling it block shooter if the name is not taken
and well i restart my computer didnt save so i rewrote most of it but not all of it
so i tryed to use the For..next loop to count my bullet then delete my bullet sprite but it didnt work i didnt write it back in the new code i was thinking maybe someone can give me an exp or something anyway here is the the code
textmode(text_buffered)
dim i
struc Splayer
dim player,playerx,playery
dim playerbullet
endstruc
struc Seplayer
dim eplayer,eplayerx,eplayery
dim eplayerbullet
endstruc
struc sgameinfo
dim score
dim level
dim lifes
dim game
endstruc
dim Splayer player,Seplayer eplayer,sgameinfo gameinfo,playerbullety
'player
player.playery = 460
player.playerx = 320
player.player = newsprite(loadtex("data\.png"))
sprsetpos(player.playerx,player.playery)
sprsetcolor(255,0,0)
'eplayer
'gameinfo
gameinfo.score = 0
gameinfo.level = 1
gameinfo.lifes = 3
gameinfo.game = true
bullet:
while gameinfo.game
sprsetpos(player.playerx,player.playery)
locate 0,0:print"Score " + gameinfo.score
locate 0,1:print"level " + gameinfo.level
locate 0,2:print"life " + gameinfo.lifes
if scankeydown(vk_left) then
bindsprite(player.player)
player.playerx = player.playerx -1
elseif scankeydown(vk_right) then
bindsprite(player.player)
player.playerx = player.playerx +1
endif
if scankeydown(vk_space) then
player.playerbullet = newsprite(loadtex("data\.png"))
sprsetpos(player.playerx,player.playery)
sprsetyvel(-1)
endif
if player.playerx < 20 then
player.playerx = player.playerx +1
elseif player.playerx > 620 then
player.playerx = player.playerx -1
endif
animatesprites()
drawtext()
wend
and well i restart my computer didnt save so i rewrote most of it but not all of it
so i tryed to use the For..next loop to count my bullet then delete my bullet sprite but it didnt work i didnt write it back in the new code i was thinking maybe someone can give me an exp or something anyway here is the the code
textmode(text_buffered)
dim i
struc Splayer
dim player,playerx,playery
dim playerbullet
endstruc
struc Seplayer
dim eplayer,eplayerx,eplayery
dim eplayerbullet
endstruc
struc sgameinfo
dim score
dim level
dim lifes
dim game
endstruc
dim Splayer player,Seplayer eplayer,sgameinfo gameinfo,playerbullety
'player
player.playery = 460
player.playerx = 320
player.player = newsprite(loadtex("data\.png"))
sprsetpos(player.playerx,player.playery)
sprsetcolor(255,0,0)
'eplayer
'gameinfo
gameinfo.score = 0
gameinfo.level = 1
gameinfo.lifes = 3
gameinfo.game = true
bullet:
while gameinfo.game
sprsetpos(player.playerx,player.playery)
locate 0,0:print"Score " + gameinfo.score
locate 0,1:print"level " + gameinfo.level
locate 0,2:print"life " + gameinfo.lifes
if scankeydown(vk_left) then
bindsprite(player.player)
player.playerx = player.playerx -1
elseif scankeydown(vk_right) then
bindsprite(player.player)
player.playerx = player.playerx +1
endif
if scankeydown(vk_space) then
player.playerbullet = newsprite(loadtex("data\.png"))
sprsetpos(player.playerx,player.playery)
sprsetyvel(-1)
endif
if player.playerx < 20 then
player.playerx = player.playerx +1
elseif player.playerx > 620 then
player.playerx = player.playerx -1
endif
animatesprites()
drawtext()
wend