Sanddunes

Miscellaneous Forums/Blitz Showcase/Sanddunes

Hi,
here is a small "game" I programmed.
You can move an oval around the screen (<^>) and can use a turboboost(space).
The goal of the game is it to catch another oval that moves around the screen as often as you can:


Strict

Graphics 800,600

Global taste:Int

Global x:Float=400
Global y:Float=300

Global abstand:Float
Global abstand2:Float

Global boden:Float[80,60]
Global flimmer:Float
Global change:Int

Global turbo:Float = 600
Global punkte:Int = 0


Global turbomax = 600

Global x2:Float
Global y2:Float

Global z1:Float
Global z2:Float

Global xs:Float=1.25
Global ys:Float=1.25


For Local xxx:Int = 0 To 79
For Local yyy:Int = 0 To 59

boden[xxx,yyy] = Rand(170,200)

Next
Next

Repeat

If change = 0 Then
flimmer = flimmer + .3
End If
If change = 1 Then
flimmer = flimmer - .3
End If
If flimmer > 15 Then
change = 1
flimmer = 15
End If
If flimmer < 1 Then
change = 0
flimmer = 1
End If

For Local xx:Int = 0 To 79
For Local yy:Int = 0 To 59

abstand = (((xx*10)-x)^2+((yy*10)-y)^2)^0.5

SetColor boden[xx,yy]-abstand+flimmer,((boden[xx,yy])-abstand)+flimmer,((boden[xx,yy]/5)-abstand)+flimmer
DrawRect xx*10,yy*10,10,10

If abstand < 20 And boden[xx,yy] > 100 Then
If Not KeyDown(key_down) And Not KeyDown(key_up) And Not KeyDown(key_right) And Not KeyDown(key_left) Then
boden[xx,yy] = boden[xx,yy]-0
Else
boden[xx,yy] = boden[xx,yy]-((20-abstand)/8)
End If
End If


Next
Next

If taste = 0 Then
DrawText "Drueck ne Taste Spast" ,330,25
SetColor 255,0,0

End If

taste = 0



'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

If KeyDown (key_down) Then			'Hier schreibe ich alles ausführlich hin.Alles was ich an dieser KeyDown-Bedingung gemacht habe hab ich auch bei den anderen gemacht!
y = y+0.5
taste = 1

If KeyDown(key_space) And turbo > 0 Then       	'Wenn nach unten gedrückt wird (s.o.) UND Leertaste  gedrückt wird
y = y +1.25								'--> dann wird noch zusätzlich y verändert (also insgesamt um 1.5)
turbo = turbo - 1
End If
									'Hier habe ich die zweite Keydown(key_down)-Bedingung entfernt, da man das alles auch in die eine schreiben kann!	
                                
									'Hier habe ich Drawoval entfernt
End If

''''''''''''''''''''''''''''''''Jetzt folgt dasselbe für die anderen Tasten:Space-Bedingung,Vereinfachung,Drawoval entfernen...''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


If KeyDown (key_right) Then 
x = x+0.5
taste = 1

If KeyDown (key_space) And turbo > 0 Then
x = x+1.25
turbo = turbo - 1
End If


End If




If KeyDown (key_left) Then
x=x-0.5
taste = 1

If KeyDown (key_space) And turbo > 0 Then
x = x - 1.25
turbo = turbo - 1
End If


End If




If KeyDown (key_up) Then
y=y-0.5
taste = 1

If KeyDown(key_space) And turbo > 0  Then
y = y - 1.25
turbo = turbo - 1
End If


End If


SetColor 0,0,100
DrawOval x,y,30,30	    			'Ball wird gemalt(Steht mitten in der Hauptschleife ohne Bedingung --> Er wird auch gemalt wenn keine Taste gedrückt wird				


x2=x2+xs
y2=y2+ys

If x2 > 800 Then
x2 = -30
End If
If x2<-30 Then
x2 = 800
End If

If y2 > 600 Then
y2 = -30
End If
If y2<-30 Then
y2 = 600
End If

z1 = Rand(1,1000)
z2 = Rand(1,1000)


If z1 = 2 Then

xs = -xs
End If
If z2 = 2 Then

ys = -ys
End If


abstand2 = (((x2)-x)^2+((y2)-y)^2)^0.5
SetColor 50-abstand2,150-abstand2,50-abstand2
DrawOval x2,y2,25,25

If abstand2 < 30 Then
punkte = punkte + 1
turbomax = turbomax - 40
x2 = Rand(1,800)
y2 = Rand(1,600)
xs = 1.25
ys = 1.25

For Local xxx:Int = 0 To 79
For Local yyy:Int = 0 To 59

boden[xxx,yyy] = Rand(170,200)

Next
Next

End If


If abstand2 < 100 Then
If x2 > x Then
xs = 1.25
End If
If x2 < x Then
xs = -1.25
End If

If y2 > y Then
ys = 1.25
End If
If y2 < y Then
ys = -1.25
End If

End If

If turbo < turbomax Then
turbo = turbo + 0.5
End If


SetColor 150,50,50
DrawRect 10,10,(turbomax/4),10
SetColor 50,150,50
DrawRect 10,10,(turbo/4),10

DrawText "Punkte: "+punkte,10,30




''''''''''''''''''''''''''''''''''''''Jetzt kommen die Wände/bzw. Teleporterwände''''''''''''''''''''''''''''''''''''''''''




If x > 800 Then            'Wenn die x-Position größer als 800 ist, dann wird X auf - 30 gesetzt (-30 weil man den Ball dann noch nicht sieht, sonst würde er ja plötzlich auftauchen)
x = -30
End If

If x < -30 Then				'Wenn die x-Position kleiner als - 30 ist wird X auf 800 gesetzt... logisch,oder?
x = 800
End If

If y < -30 Then				'Dasselbe kommt dann zweimal für Y
y = 600
End If

If y > 600 Then
y = 0
End If


'''''''''''''''''''''''Wichtig bei den "Wänden" ist, dass z.B. nicht die Bedingung da steht If x < - 29: Denn dann würde wenn mann rechts rausgeht X auf -30 gesetzt werden, woraufhin die Bedingung X <-29 wiederum zutrifft und wieder direkt auf 800 gesetzt werden würde. Aber das nur nebenbei!''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''



Flip
Cls

Until KeyDown (key_escape)
End




Interesting game.

One bug/feature I noticed: The space turboboost only works horizontal, vertical, and when you go diaginal up/right. There is no boost when you are moving diagonal up/left, down/left or down/right.

so what's the background for?

Sehr interessant

Habs verstanden lucas

@ Warpy
Something has to be there in the background, to show the "lightcone".
It's only a small effect, which looks interesting in my eyes!

Thx for your feedback,
Lukas

ok, cool. I thought there was something important gameplay-wise that I was missing. It's a cool effect, anyway.