Qbasicnews.com

Full Version: simple question for Qpro's...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi,

i am from germany and excuse me if i will make to much mistakes in my text. i cant speak english so well :oops: ...

so i've got a question but i am a real noob *g*
i want to program a simple 2d game.

this is the beginning of the code:

x = 310
y = 150

cls
screen 9
co
circle (x,y),20,1
a$ = inkey$
if a$ = "w" then
circle (x,y),20,0
y = y - 10
end if
if a$ = "s" then
circle (x,y),20,0
y = y + 10
end if
if a$ = "a" then
circle (x,y),20,0
x = x - 10
end if
if a$ = "d" then
circle (x,y),20,0
x = x + 10
end if

now to my question. i want to make a wall left right over and under.
and then i want to make some enemies when you touch them you
are game over...
can you read my text?
can you please help me??

thanks
Cronos
Code:
x = 310
y = 150


screen 13
do
cls
circle (x,y),20,1
a$ = inkey$
if a$ = "w" then
circle (x,y),20,0
y = y - 10
if y < 0 then y = 0
end if
if a$ = "s" then
circle (x,y),20,0
y = y + 10
if y > 199 then y = 199
end if
if a$ = "a" then
circle (x,y),20,0
x = x - 10
if x < 0 then x = 0
end if
if a$ = "d" then
circle (x,y),20,0
x = x + 10
if x > 319 then x = 319
end if
line (0,0)-(319,199),15,b
circle(100,100),20,0

if x => 90 and y => 90 and x <= 110 and y <=110 then
  print "You died"
  end
end if

loop
that is for just one enemy and a bounding box for the player
shouldnt this

Code:
circle(100,100),20,0

if x => 90 and y => 90 and x <= 110 and y <=110 then

be replaced with this if the radius is 20 and the color should not be 0

Code:
circle(100,100),20,1 <- the 1 is blue

if x => 80 and y => 80 and x <= 120 and y <=120 then