Author Topic: Re: Felippe's Locomotive  (Read 1081 times)

0 Members and 1 Guest are viewing this topic.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Felippe's Locomotive
« on: March 26, 2019, 01:16:40 am »
This is SO cool. I love the old text animations... Well done!
Logic is the beginning of wisdom.

FellippeHeitor

  • Guest
Re: Felippe's Locomotive
« Reply #1 on: March 26, 2019, 09:31:33 am »
I love the recreation, [banned user]! I knew you'd dig that animation :-)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Felippe's Locomotive
« Reply #2 on: March 26, 2019, 10:22:59 am »
This is begging for stationary train image moving wheels with background scenery flying past or perhaps a Star Field. ;)
« Last Edit: March 26, 2019, 10:25:12 am by bplus »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Felippe's Locomotive
« Reply #3 on: March 26, 2019, 10:33:57 am »
How is this better than my...

train = "  [oo][oo][oo`>  "

...from my Christmas card entry? Is it the smoke? I purposely left out smoke to conform to the "New Green Deal."

Pete :D

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

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Felippe's Locomotive
« Reply #4 on: March 26, 2019, 12:51:14 pm »
Quote
Nice.  I think my train is your train zoomed in.  ;~)

LOL - Actually, I was thinking about posting that!

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: Felippe's Locomotive
« Reply #5 on: March 26, 2019, 11:07:34 pm »
Quote
Quote from: bplus on Today at 10:22:59 AM
This is begging for stationary train image moving wheels with background scenery flying past or perhaps a Star Field. ;)

You have the code bplus.  Have @ it.  Sounds interesting.

Have @ it, he has!
Code: QB64: [Select]
  1. _TITLE "Ghost Locomotive" 'from [banned user] post 2019-03-24 mod B+ 2019-03-26
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. _SCREENMOVE 200, 20
  4.  
  5. 'background B+ mod
  6. DIM SHARED scape&
  7. LoadLandscape
  8. scapeWidth = _WIDTH(scape&)
  9. scapeHeight = _HEIGHT(scape&)
  10. 'PRINT scapeWidth, scapeHeight
  11.  
  12. 'train stuff [banned user] and Fellippe?
  13. DIM Pattern AS STRING
  14.  
  15. DIM SHARED Train(7, 10) AS STRING
  16. DIM SHARED Coal(10) AS STRING
  17.  
  18. DIM Smoke1 AS STRING
  19. DIM Smoke2 AS STRING
  20. DIM Smoke3 AS STRING
  21. DIM Smoke4 AS STRING
  22. Smoke1 = SPACE$(16) + "@@@@"
  23. Smoke2 = SPACE$(16) + "          @ @ "
  24. Smoke3 = SPACE$(16) + "    @@     @@     @     @     @    "
  25. Smoke4 = SPACE$(16) + "       @@     @@     @     @     @ "
  26. LoadTrain
  27. col = 1
  28. row = 7
  29. Pattern = "6545321"
  30. p = 6
  31.  
  32. le = scapeWidth - 800
  33.     CLS
  34.  
  35.     '    background stuff
  36.     IF le + 800 > scapeWidth THEN
  37.         te = scapeWidth - le
  38.         _PUTIMAGE (0, 0)-(te, scapeHeight), scape&, 0, (scapeWidth - te, 0)-(scapeWidth, scapeHeight)
  39.         _PUTIMAGE (te, 0)-(800, scapeHeight), scape&, 0, (0, 0)-(800 - te, scapeHeight)
  40.     ELSE
  41.         _PUTIMAGE (0, 0)-(800, scapeHeight), scape&, 0, (le, 0)-(le + 800, scapeHeight)
  42.     END IF
  43.     '_PRINTSTRING (5, 5), STR$(le)
  44.     le = le - 1
  45.     IF le < 0 THEN le = scapeWidth
  46.  
  47.  
  48.     'train stuff
  49.     COLOR _RGBA32(255, 255, 255, 200), _RGBA32(0, 0, 0, 0)
  50.     FOR j = 0 TO 9
  51.         '_PRINTSTRING (0, 16 * j + 112), MID$(Train(p, j + 1), i, 80)
  52.         _PRINTSTRING (64, 16 * j + 442), MID$(Train(p, j + 1), 1, 84)
  53.     NEXT
  54.     IF i < LEN(Smoke4) THEN
  55.         IF fcount MOD 30 < 15 THEN
  56.             _PRINTSTRING (0, 96 + 300), MID$(Smoke1, i, 80)
  57.             _PRINTSTRING (0, 64 + 300), SPACE$(8) + MID$(Smoke1, i, 80)
  58.             _PRINTSTRING (0, 32 + 300), SPACE$(24) + MID$(Smoke3, i, 80)
  59.         ELSE
  60.             _PRINTSTRING (0, 80 + 280), SPACE$(4) + MID$(Smoke1, i, 80)
  61.             _PRINTSTRING (0, 48 + 280), SPACE$(12) + MID$(Smoke2, i, 80)
  62.             _PRINTSTRING (0, 32 + 280), SPACE$(24) + MID$(Smoke4, i, 80)
  63.         END IF
  64.     END IF
  65.     fcount = fcount + 1
  66.     IF fcount = 60 THEN fcount = 0
  67.     IF fcount MOD 3 = 0 THEN
  68.         col = col + 1: i = i + 1
  69.         IF col = LEN(Pattern) + 1 THEN col = 1
  70.         IF i > LEN(Train(1, 1)) - 80 THEN i = 1
  71.         p = VAL(MID$(Pattern, col, 1))
  72.     END IF
  73.  
  74.     _DISPLAY
  75.     _LIMIT 90 '<<< EDIT
  76.  
  77. SUB LoadLandscape
  78.     cur& = _DEST
  79.     xmax = 800 * 6: ymax = 600
  80.     scape& = _NEWIMAGE(xmax, ymax, 32)
  81.     _DEST scape&
  82.  
  83.     FOR i = 0 TO ymax
  84.         midInk 0, 0, 128, 128, 128, 200, i / ymax
  85.         LINE (0, i)-(xmax, i)
  86.     NEXT
  87.     'the land
  88.     startH = ymax - 200
  89.     rr = 70: gg = 70: bb = 90
  90.     FOR mountain = 1 TO 6
  91.         Xright = 0
  92.         y = startH
  93.         COLOR _RGB(rr, gg, bb)
  94.         WHILE Xright < xmax - 50
  95.             ' upDown = local up / down over range, change along Y
  96.             ' range = how far up / down, along X
  97.             upDown = (RND * .8 - .4) * (mountain * .5)
  98.             range = Xright + rand%(15, 25) * 2.5 / mountain
  99.             IF range > xmax - 50 THEN range = xmax - 50
  100.             lastx = Xright - 1
  101.             FOR x = Xright TO range
  102.                 test = y + upDown
  103.                 IF ABS(test - startH) < .1 * startH THEN y = test
  104.                 LINE (lastx, y)-(x, ymax), , BF 'just lines weren't filling right
  105.                 lastx = x
  106.             NEXT
  107.             Xright = range
  108.         WEND
  109.         x = lastx + 1
  110.         WHILE x <= xmax
  111.             y = y + (startH - y) / 40
  112.             LINE (lastx, y)-(x, ymax), , BF 'just lines weren't filling right
  113.             lastx = x
  114.             x = x + 1
  115.         WEND
  116.         rr = rand%(rr - 15, rr): gg = rand%(gg - 15, gg): bb = rand%(bb - 25, bb)
  117.         IF rr < 0 THEN rr = 0
  118.         IF gg < 0 THEN gg = 0
  119.         IF bb < 0 THEN bb = 0
  120.         startH = startH + rand%(5, 20)
  121.     NEXT
  122.     _DEST cur&
  123.  
  124. FUNCTION rand% (lo%, hi%)
  125.     rand% = INT(RND * (hi% - lo% + 1)) + lo%
  126.  
  127. SUB midInk (r1%, g1%, b1%, r2%, g2%, b2%, fr##)
  128.     COLOR _RGB(r1% + (r2% - r1%) * fr##, g1% + (g2% - g1%) * fr##, b1% + (b2% - b1%) * fr##)
  129.  
  130.  
  131. SUB LoadTrain
  132.     DIM t AS STRING
  133.     'DIM s AS STRING
  134.     's = SPACE$(80)
  135.  
  136.     FOR j = 1 TO 10
  137.         READ t: Coal(j) = t
  138.     NEXT
  139.  
  140.     FOR i = 1 TO 6
  141.         FOR j = 1 TO 10
  142.             'READ t: Train(i, j) = s + t + Coal(j) + s
  143.             READ t: Train(i, j) = t + Coal(j)
  144.         NEXT
  145.     NEXT
  146.     EXIT SUB
  147.  
  148.     DATA "                             "
  149.     DATA "                             "
  150.     DATA "    _________________        "
  151.     DATA "   _|                \_____A "
  152.     DATA " =|                        | "
  153.     DATA " -|                        | "
  154.     DATA "__|________________________|_"
  155.     DATA "|__________________________|_"
  156.     DATA "   |_D__D__D_|  |_D__D__D_|  "
  157.     DATA "    \_/   \_/    \_/   \_/   "
  158.  
  159.     DATA "      ====        ________                ___________"
  160.     DATA "  _D _|  |_______/        \__I_I_____===__|_________|"
  161.     DATA "   |(_)---  |   H\________/ |   |        =|___ ___|  "
  162.     DATA "   /     |  |   H  |  |     |   |         ||_| |_||  "
  163.     DATA "  |      |  |   H  |__--------------------| [___] |  "
  164.     DATA "  | ________|___H__/__|_____/[][]~\_______|       |  "
  165.     DATA "  |/ |   |-----------I_____I [][] []  D   |=======|__"
  166.     DATA "__/ =| o |=-~~\  /~~\  /~~\  /~~\ ____Y___________|__"
  167.     DATA " |/-=|___|=    ||    ||    ||    |_____/~\___/       "
  168.     DATA "  \_/      \O=====O=====O=====O_/      \_/           "
  169.  
  170.     DATA "      ====        ________                ___________"
  171.     DATA "  _D _|  |_______/        \__I_I_____===__|_________|"
  172.     DATA "   |(_)---  |   H\________/ |   |        =|___ ___|  "
  173.     DATA "   /     |  |   H  |  |     |   |         ||_| |_||  "
  174.     DATA "  |      |  |   H  |__--------------------| [___] |  "
  175.     DATA "  | ________|___H__/__|_____/[][]~\_______|       |  "
  176.     DATA "  |/ |   |-----------I_____I [][] []  D   |=======|__"
  177.     DATA "__/ =| o |=-~~\  /~~\  /~~\  /~~\ ____Y___________|__"
  178.     DATA " |/-=|___|=O=====O=====O=====O   |_____/~\___/       "
  179.     DATA "  \_/      \__/  \__/  \__/  \__/      \_/           "
  180.  
  181.     DATA "      ====        ________                ___________"
  182.     DATA "  _D _|  |_______/        \__I_I_____===__|_________|"
  183.     DATA "   |(_)---  |   H\________/ |   |        =|___ ___|  "
  184.     DATA "   /     |  |   H  |  |     |   |         ||_| |_||  "
  185.     DATA "  |      |  |   H  |__--------------------| [___] |  "
  186.     DATA "  | ________|___H__/__|_____/[][]~\_______|       |  "
  187.     DATA "  |/ |   |-----------I_____I [][] []  D   |=======|__"
  188.     DATA "__/ =| o |=-O=====O=====O=====O \ ____Y___________|__"
  189.     DATA " |/-=|___|=    ||    ||    ||    |_____/~\___/       "
  190.     DATA "  \_/      \__/  \__/  \__/  \__/      \_/           "
  191.  
  192.     DATA "      ====        ________                ___________"
  193.     DATA "  _D _|  |_______/        \__I_I_____===__|_________|"
  194.     DATA "   |(_)---  |   H\________/ |   |        =|___ ___|  "
  195.     DATA "   /     |  |   H  |  |     |   |         ||_| |_||  "
  196.     DATA "  |      |  |   H  |__--------------------| [___] |  "
  197.     DATA "  | ________|___H__/__|_____/[][]~\_______|       |  "
  198.     DATA "  |/ |   |-----------I_____I [][] []  D   |=======|__"
  199.     DATA "__/ =| o |=-~O=====O=====O=====O\ ____Y___________|__"
  200.     DATA " |/-=|___|=    ||    ||    ||    |_____/~\___/       "
  201.     DATA "  \_/      \__/  \__/  \__/  \__/      \_/           "
  202.  
  203.     DATA "      ====        ________                ___________"
  204.     DATA "  _D _|  |_______/        \__I_I_____===__|_________|"
  205.     DATA "   |(_)---  |   H\________/ |   |        =|___ ___|  "
  206.     DATA "   /     |  |   H  |  |     |   |         ||_| |_||  "
  207.     DATA "  |      |  |   H  |__--------------------| [___] |  "
  208.     DATA "  | ________|___H__/__|_____/[][]~\_______|       |  "
  209.     DATA "  |/ |   |-----------I_____I [][] []  D   |=======|__"
  210.     DATA "__/ =| o |=-~~\  /~~\  /~~\  /~~\ ____Y___________|__"
  211.     DATA " |/-=|___|=   O=====O=====O=====O|_____/~\___/       "
  212.     DATA "  \_/      \__/  \__/  \__/  \__/      \_/           "
  213.  
  214.     DATA "      ====        ________                ___________"
  215.     DATA "  _D _|  |_______/        \__I_I_____===__|_________|"
  216.     DATA "   |(_)---  |   H\________/ |   |        =|___ ___|  "
  217.     DATA "   /     |  |   H  |  |     |   |         ||_| |_||  "
  218.     DATA "  |      |  |   H  |__--------------------| [___] |  "
  219.     DATA "  | ________|___H__/__|_____/[][]~\_______|       |  "
  220.     DATA "  |/ |   |-----------I_____I [][] []  D   |=======|__"
  221.     DATA "__/ =| o |=-~~\  /~~\  /~~\  /~~\ ____Y___________|__"
  222.     DATA " |/-=|___|=    ||    ||    ||    |_____/~\___/       "
  223.     DATA "  \_/      \_O=====O=====O=====O/      \_/           "
  224.  
  225.  
  226.  

There is something off with the wheels action.

« Last Edit: March 27, 2019, 12:26:09 am by bplus »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Felippe's Locomotive
« Reply #6 on: March 27, 2019, 03:08:10 am »
I liked it better when Space Ghost had a star ship, but apparently he fell on hard ties and now has to toddle around in a train. I blame Obama.

Nice effects with the moving mountains...

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

FellippeHeitor

  • Guest
Re: Felippe's Locomotive
« Reply #7 on: March 27, 2019, 09:01:52 am »
sl -f gave me Back to the Future feelings.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Felippe's Locomotive
« Reply #8 on: March 27, 2019, 09:15:51 am »
Hi [banned user],

So the wheels animation was controlled by pattern, I wondered what that was about. :)

Your 2nd code commanding sl with switches reminds me of your bot, I liked the little train variation best.


Hi Fellippe,

Back to the Future? oh that's right one of the sequels did involve a train. :)


More ideas on background:
Before getting static background done, I had an idea about a background generator line routine but not sure if shifting vertical lines down screen is doable quickly enough.

After getting static background done, I immediately got an idea for parallax display which might also be done with a background generator line routine but here you have to push lines down screen at different rates. hmm...

« Last Edit: March 27, 2019, 09:28:23 am by bplus »

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Felippe's Locomotive
« Reply #9 on: March 27, 2019, 05:46:17 pm »
"man sl" needs either a prompt or delay. When I selected 'man sl' all I had was the 'loco' prompt. Other than that... Great job.

J
Logic is the beginning of wisdom.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Felippe's Locomotive
« Reply #10 on: March 27, 2019, 06:04:41 pm »
Man sl calls Jerry Brown's Bull#$%^ train. That's why you don't see it!

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: Felippe's Locomotive
« Reply #11 on: March 27, 2019, 07:29:52 pm »
"man sl" needs either a prompt or delay. When I selected 'man sl' all I had was the 'loco' prompt. Other than that... Great job.

J

Add line indicated in this snip:
Code: QB64: [Select]
  1. SUB man_sl
  2.     PRINT "SYNOPSIS"
  3.     PRINT "          sl [ -alF ]"
  4.     PRINT
  5.  
  6.     PRINT "OPTIONS"
  7.     PRINT "         -a    Accident"
  8.     PRINT "         -l    Shrink"
  9.     PRINT "         -F    Lift-off"
  10.     PRINT
  11.     INPUT "Press <enter> to continue... ", wate$ '<<<<<<<<<<<<<<<<< add this line
  12.  

This will delay execution until you have actually seen and read the manual.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Felippe's Locomotive
« Reply #12 on: March 27, 2019, 07:50:11 pm »
I think I looked at 5 different ones when trying some of the different switches. I could be wrong, because I really wasn't keeping "TRACK."

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

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: Felippe's Locomotive
« Reply #13 on: March 29, 2019, 10:42:21 am »
This ASCII animation is very cool! Good work! :)
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials