boost

BlitzPlus Forums/BlitzPlus Programming/boost

pyro821(Posted 2004) [#1]
I what to make a game were you can move arrow any where on the screen. I can do all that really easy but the main thing I what to do is when you hit a button say shift your speed doubles then when you let go your speed goes back to normal. I have tryed meny diffrent way but can not get it to work right.


Mr Brine(Posted 2004) [#2]
Hi Pyro

check this out:


Graphics 640, 480

Repeat

xs = MouseXSpeed()
ys = MouseYSpeed()

MoveMouse 320, 240
MouseXSpeed()
MouseYSpeed()


If(MouseDown(1))

xs = xs * 2
ys = ys * 2

End If

x = x + xs
y = y + ys

Text x, y, "*"

Flip

Cls

Until KeyHit(1)

regards

Mr Brine


pyro821(Posted 2004) [#3]
Thank you it will help me alot.


Rook Zimbabwe(Posted 2004) [#4]
Hmmm looks OK but:
borrowing on your code:
[code]
;borrowing Mr Brines code
Graphics 640, 480
speedflag = 1
Repeat

xs = MouseXSpeed()
ys = MouseYSpeed()

MoveMouse 320, 240
MouseXSpeed()
MouseYSpeed()


If KeyHit(50)>=1 Then speedflag = 1 - speedflag

if speedflag = 0 then
xs = xs * 2
ys = ys * 2
End If

x = x + xs
y = y + ys

Text x, y, "X" ; you know you can put a sprite or image here

Flip

Cls

Until KeyHit(1)