Author Topic: Marvin has a ball  (Read 5894 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Marvin has a ball
« on: September 29, 2021, 09:21:11 pm »
My first use of an image sheet I think.

Here is what the SdlBasic code looked like 6 years ago!
Code: [Select]
'
'    Marvin has a ball.sdlbas 2015-05-29 j&m
'
'    needs: Marvin32x48.png  y=0 back, y=1 right, y=2 front, y=3 left
'
sub rball(x)
for i=12 to 0 step -1
ink(rgb(255-i*21,0,0))
fillcircle(x,388,i)
next
end sub
sub bball(x,y)
for i=125 to 0 step -1
ink(rgb(255-i*2,0,0))
fillcircle(x,y,i)
next
end sub
'========================================================== main
setDisplay(600,500,32,1)
autoback(-2)
loadImage("marvin32x48.png",1)
x = 0:y=0:imx=0:imy=1:marvinX=425:marvinY=352
ink(rgb(0,215,65))
bar(0,400,screenwidth, screenheight)
ink(rgb(0,185,255))
bar(0,0,screenwidth,400)
while 0=0
    ink(rgb(0,185,255))
bar(0,0,screenwidth,400)
    blt(1,(marvinX mod 4)*32,imy*48,32,48,marvinX,marvinY)
rball(marvinX+35)
    screenswap
    wait(50)
    marvinX = marvinX + 1
    if marvinX>600 then: exit while: end if
wend
imy=3
while 0=0
    ink(rgb(0,185,255))
bar(0,0,screenwidth,400)
    blt(1,(marvinX mod 4)*32,imy*48,32,48,marvinX,marvinY)
bball(marvinX+130,275)
    screenswap
    marvinX = marvinX - 21
    if marvinX<-295 then
text(270,120,16,"wait. . .  ")
screenswap
wait(3000)
exit while
end if
wend
imy=2:marvinX=300:marvinY=400:ballY=marvinY+173
while 0=0
    ink(rgb(0,185,255))
bar(0,0,screenwidth,400)
bball(marvinX+16,ballY)
blt(1,(marvinY mod 4)*32,imy*48,32,48,marvinX,marvinY)
ink(rgb(0,215,65))
bar(0,400,screenwidth, screenheight)
    screenswap
    marvinY = marvinY -1
if marvinY<-80 then
end
    elseif marvinY=0 then
marvinY=-49
elseif marvinY<90 then
ballY =290 :imy=0
else
ballY= marvinY+173
end if
wend


Today's tranlation and mods for QB64:
Code: QB64: [Select]
  1. _Title "Marvin has a ball" ' b+ trans from SdlBasic 2021-09-29
  2. ' needs: Marvin32x48.png  y=0 back, y=1 right, y=2 front, y=3 left
  3. Screen _NewImage(800, 800 * ratio, 32)
  4. m& = _LoadImage("marvin32x48.png")
  5. x = 0: y = 0: imx = 0: imy = 1: marvinX = 425: marvinY = 352
  6. Line (0, 400)-(_Width, _Height), _RGB32(0, 215, 65), BF
  7. Line (0, 0)-(_Width, 400), _RGB32(0, 185, 255), BF
  8. While _KeyDown(27) = 0 ' sisyphus
  9.     Line (0, 0)-(_Width, 400), _RGB32(0, 185, 255), BF
  10.     blt m&, (marvinX Mod 4) * 32, imy * 48, 32, 48, marvinX, marvinY
  11.     drawBall marvinX + 35, 400 - 12, 12, &HFFFF0000
  12.     _Display
  13.     _Limit 40
  14.     marvinX = marvinX + 1
  15.     If marvinX > _Width Then Exit While
  16. imy = 3: l = 5
  17. While _KeyDown(27) = 0 ' run!
  18.     Line (0, 0)-(_Width, 400), _RGB32(0, 185, 255), BF
  19.     blt m&, (marvinX Mod 4) * 32, imy * 48, 32, 48, marvinX, marvinY
  20.     drawBall marvinX + 130, 275, 125, &HFFFF0000
  21.     _Display
  22.     marvinX = marvinX - 21
  23.     If marvinX < -295 Then
  24.         _Display
  25.         _Delay 3
  26.         Exit While
  27.     End If
  28.     _Limit l
  29.     l = l + .5
  30. imy = 2: marvinX = _Width / 2 - 16: marvinY = 400: ballY = marvinY + 173
  31. While _KeyDown(27) = 0 ' conquer
  32.     Line (0, 0)-(_Width, 400), _RGB32(0, 185, 255), BF
  33.     drawBall marvinX + 16, ballY, 125, &HFFFF0000
  34.     blt m&, (marvinY Mod 4) * 32, imy * 48, 32, 48, marvinX, marvinY
  35.     Line (0, 400)-(_Width, _Height), _RGB32(0, 215, 65), BF
  36.     _Display
  37.     _Limit 10
  38.     marvinY = marvinY - 1
  39.     If marvinY < -80 Then
  40.         End
  41.     ElseIf marvinY = 0 Then
  42.         marvinY = -49
  43.     ElseIf marvinY < 90 Then
  44.         ballY = 280: imy = 0
  45.     Else
  46.         ballY = marvinY + 173
  47.     End If
  48.  
  49. Sub blt (imageHandle&, sx, sy, sw, sh, dx, dy) ' for johnno to trans SdlBasic to QB64
  50.     _PutImage (dx, dy), imageHandle&, 0, (sx, sy)-Step(sw, sh)
  51.  
  52. Sub drawBall (x, y, r, c As _Unsigned Long)
  53.     Dim rred As Long, grn As Long, blu As Long, rr As Long, f
  54.     rred = _Red32(c): grn = _Green32(c): blu = _Blue32(c)
  55.     For rr = r To 0 Step -1
  56.         f = 1 - rr / r
  57.         fcirc x, y, rr, _RGB32(rred * f, grn * f, blu * f)
  58.     Next
  59.  
  60. Sub fcirc (CX As Long, CY As Long, R As Long, C As _Unsigned Long)
  61.     Dim Radius As Long, RadiusError As Long
  62.     Dim X As Long, Y As Long
  63.     Radius = Abs(R): RadiusError = -Radius: X = Radius: Y = 0
  64.     If Radius = 0 Then PSet (CX, CY), C: Exit Sub
  65.     Line (CX - X, CY)-(CX + X, CY), C, BF
  66.     While X > Y
  67.         RadiusError = RadiusError + Y * 2 + 1
  68.         If RadiusError >= 0 Then
  69.             If X <> Y + 1 Then
  70.                 Line (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  71.                 Line (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  72.             End If
  73.             X = X - 1
  74.             RadiusError = RadiusError - X * 2
  75.         End If
  76.         Y = Y + 1
  77.         Line (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  78.         Line (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  79.     Wend
  80.  

@johnno56  you might be interested in the blt translation for use in QB64, after I looked up SdlBasic docs for the argument variables it was easy to translate and it worked the first time!

Attached is the zip of code with image.
* Marvin has a ball.zip (Filesize: 14.29 KB, Downloads: 193)

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Marvin has a ball
« Reply #1 on: September 29, 2021, 11:09:57 pm »
Marvin only has one ball? No wonder he's a little testy! Add some Loony Tunes music in the background, and you'd just about have a full blown cartoon going on there. Nice job!

Pete

Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Marvin has a ball
« Reply #2 on: September 30, 2021, 05:33:22 am »
What?!  No space modulator?

Nice conversion... of course I am going to have a close look at the super-complicated 'blt' routine... with an extreme 'scrute'... Cool...
Logic is the beginning of wisdom.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Marvin has a ball
« Reply #3 on: September 30, 2021, 07:08:19 am »
Marvin only has one ball?

Pete

The other, of course, is in the Albert Hall.  [If this British reference baffles anyone, please consult Colonel Bogey].

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Marvin has a ball
« Reply #4 on: September 30, 2021, 01:06:20 pm »
What?!  No space modulator?

Nice conversion... of course I am going to have a close look at the super-complicated 'blt' routine... with an extreme 'scrute'... Cool...

Really? Didn't you know the right to bear space modulators was rescinded by the Martian Government in the early 1990's? Unfortunately, It did not prevent the use of "Ghost Modulators," which still creates interplanetary havoc to this day.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Marvin has a ball
« Reply #5 on: September 30, 2021, 02:14:01 pm »
OK after a little Google hunt, how about Colonel Bogey's March?

Edit: Eh, skip the you tube thing on Hitler, sorry.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Marvin has a ball
« Reply #6 on: September 30, 2021, 04:59:42 pm »
Pete,

I must have missed the interplanetary emails from the Martian Government. Rescinded you say? I will take you at your word.

J
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Marvin has a ball
« Reply #7 on: September 30, 2021, 05:06:28 pm »
Space Modulator?



Rescinded or overcome by bugs?

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Marvin has a ball
« Reply #8 on: September 30, 2021, 05:21:34 pm »
Why hasn't the "Me Too" movement called for a person-cott of Bugs Bunny? It's clear from the video screen shot Bugs he is looking up Marvin's skirt!

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Marvin has a ball
« Reply #9 on: September 30, 2021, 05:44:35 pm »
Pete,

A couple of things...

First: "Me too" movement?

Second: "Skirt" , by traditional means, implies that the Martian is female. As he is clearly not female, and he is not a Celt (which implies the wearing of a Kilt), what he is wearing, although 'looks' like a skirt, would not be a skirt... Besides, when we watched this as kids, 'is he wearing a skirt?', did not enter our minds. We watched it because it was fun... I found the Martian's voice and lack of facial features funny... and the way he walked...

Actually... He looked more like a Roman soldier... Which fits the perception of Mars, the god of war... Roman soldiers wore a 'skirt' called a 'Pteruges' made of either leather or linen. Enough of the history lessons....

I still watch Bugs Bunny cartoons... So cool...
Logic is the beginning of wisdom.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Marvin has a ball
« Reply #10 on: September 30, 2021, 06:44:47 pm »
Me Too is a left wing feminist movement. I'll tell you things are a lot more "Looney" these days than back in the 1960's. Frankly I prefer U2. What came out of their mouths had a nice beat, and you could dance to it.

It's still a skirt.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Marvin has a ball
« Reply #11 on: September 30, 2021, 06:46:11 pm »
Mel Blanc was such a great voice actor. Until I looked it up, I didn’t know he did the voice for Marvin too, as well as bugs bunny. 

To keep it on topic, I enjoyed running the code.  Thanks for posting the sdlbasic code for comparison. I’ve never look into sdlbasic. Interesting looking. Small code too.

- Dav

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Marvin has a ball
« Reply #12 on: September 30, 2021, 07:16:32 pm »
Mel Blanc was such a great voice actor. Until I looked it up, I didn’t know he did the voice for Marvin too, as well as bugs bunny. 

To keep it on topic, I enjoyed running the code.  Thanks for posting the sdlbasic code for comparison. I’ve never look into sdlbasic. Interesting looking. Small code too.

- Dav

SDL was the window rendering software for QB64, before Rob switched to OpenGL. I still have a graphics GUI program that ran perfectly in the SDL QB64 versions, but has some misplacement of pixels in the OpenGL versions. Go figure.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Marvin has a ball
« Reply #13 on: October 01, 2021, 01:54:43 am »
Dav,

If you need to know anything about sdlbasic, well - not everything, just ask.

Pete,

Let's agree to disagree... (Psst... Not a skirt... Moo Ha ha...)
Logic is the beginning of wisdom.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Marvin has a ball
« Reply #14 on: October 01, 2021, 08:09:49 am »
Dav,
If you need to know anything about sdlbasic, well - not everything, just ask.

Thanks!  I’ll remember that.

 - Dav