Author Topic: Eggs Gravity  (Read 2083 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Eggs Gravity
« on: December 02, 2015, 02:25:25 AM »
Hello,
Code: [Select]
include "asm.inc"
Window 1024,768,1
LoadSprite "bmp/bubble.bmp",1
LoadSprite "bmp/huhn.bmp",1

single x [1000]
single y [1000]
single Xv[1000]
single Yv[1000]
single Lf[1000]
sys xstart = ScrW()/15
sys ystart = ScrH()/15

For i=1 to 1000
   Lf[i] = Rand(1,600)
   x [i] = xstart
   y [i] = ystart
   Yv[i] = Rand(1,4)
   Xv[i] = Rand(1,8)
Next

while key(27)=0
Cls 0,0,0
For i=1 to 1000
   Sprite 1,x[i],y[i],rand(16,32),rand(16,32),0
   x [i] = x [i] + Xv[i]
   y [i] = y [i] + Yv[i]
   Yv[i] = Yv[i] + 0.7
   iF y[i] >=800
      Yv[i] = Yv[i]-Yv[i] * Rand(2,16) /9
      y [i] = 768
  End iF
  Lf[i] = Lf[i] -1
  iF Lf[i] <=0
     Lf[i] = Rand(1,600)
     x [i] = xstart
     y [i] = ystart
     Yv[i] = Rand(1,4)
     Xv[i] = Rand(1,8)
  End iF
Next
sprite 2,0,0,128,128,0
Color 128,128,255
Text 200,16,28,"EGGS GRAVITY DELUXE"
Redraw
Wait 20
wend
WinEnd

.

Mike Lobanovsky

  • Guest
Re: Eggs Gravity
« Reply #1 on: December 02, 2015, 03:28:59 PM »
:D

Code: OxygenBasic
  1. ' !!! FBSL BASIC !!!
  2. #Option Implicit
  3. #Include "mingfx.inc"
  4.  
  5. Type NACHWELT: %zustand %leben: End Type
  6.  
  7. Dim j  = 0, x[1000], y[1000], xv[1000], yv[1000], lf[1000] As NACHWELT
  8.  
  9. width  = 1024: height = 768
  10. xstart = width / 15: ystart = height / 9
  11.  
  12. ei = LoadSprite("gefluegel\ei.bmp", 20, 20, 1)
  13. kueken = LoadSprite("gefluegel\kueken.bmp", 664, 83, 8)
  14. huhn = LoadSprite("gefluegel\huhn.bmp", 64, 64, 1)
  15.  
  16. For i = 0 To 1000
  17.   lf[i].zustand = ei
  18.   lf[i].leben = RandInt(1, 600)
  19.   x[i]  = xstart: y[i] = ystart
  20.   yv[i] = RandInt(1, 4)
  21.   xv[i] = RandInt(1, 8)
  22. Next
  23.  
  24. Ink = RGB(128, 128, 255)
  25.  
  26. Window(width, height, FALSE, "Peter's Chicken & Eggs")
  27.  
  28. Animate
  29.   Screen(0, 0, 0)
  30.   For i = 0 To 1000
  31.     m = lf[i].zustand
  32.     If m Then
  33.       DrawSprite(kueken, x[i], y[i], 64, 64, (j + i) Mod 8)
  34.     Else
  35.       DrawSprite(ei, x[i], y[i], %RandInt(16, 32), %RandInt(16, 32), 0)
  36.     End If
  37.     x[i] = x[i] + xv[i]: y[i] = y[i] + yv[i]: yv[i] = yv[i] + 0.7
  38.     n = height - 64 + 32 * Not m
  39.     If y[i] >= n Then
  40.       lf[i].zustand = RandInt(ei, kueken)
  41.       y[i] = n: yv[i] = yv[i] - yv[i] * RandInt(2, 16) / 9
  42.     End If
  43.     lf[i].leben = lf[i].leben - 1
  44.     If lf[i].leben <= 0 Then
  45.       lf[i].zustand = ei
  46.       lf[i].leben = RandInt(1, 600)
  47.       x[i]  = xstart: y[i] = ystart
  48.       yv[i] = RandInt(1, 4)
  49.       xv[i] = RandInt(1, 8)
  50.     End If
  51.   Next
  52.   If Incr(j) > 7 Then j = 0
  53.   DrawSprite(huhn, 0, 0, 128, 128, 0)
  54.   Message(130, 16, 24, "EGGS GRAVITY SUPER DELUXE", Ink)
  55.   Redraw()
  56.   Wait(20)
  57. Forever

.

Peter

  • Guest
Re: Eggs Gravity
« Reply #2 on: December 03, 2015, 02:18:49 AM »
Ooh, master work of the week..  ;D
I like the little pullet who jump up and down.

The price goes to Mike.

.