QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: TempodiBasic on October 13, 2018, 08:50:58 am

Title: 15 days for Halloween code challenge
Post by: TempodiBasic on October 13, 2018, 08:50:58 am
Hi
 beautyful and active QB64 community
what do you think about a 15 days challange to code something about Halloween recurrence?
each coder can choose among
 an animation,
an one level game (like tetris or google's Trex),
a story in game mode,
a point and shooting,
an educational in theme (math with monsters, potions in alchemy, dictate halloween words)

No allowed mods of another coder's program! In the while the same idea can be coded in a way very far from those already posted.

Good thinking

I wait for feedback.


Title: Re: 15 days for Halloween code challenge
Post by: Petr on October 13, 2018, 01:34:53 pm
Hi TempodiBasic,

Animation, you say? Well, I have a very primitive editor for black and white animation .... so when it's time .... but I'm such a so great graphic, that others end up with a onrush of laughter under the table ...
Title: Re: 15 days for Halloween code challenge
Post by: TempodiBasic on October 14, 2018, 04:29:59 pm
Hi Petr
Thank dor your feedback
I think that black and white can be a good point to start for Halloween animation, don't you?

Title: Re: 15 days for Halloween code challenge
Post by: Pete on October 15, 2018, 12:49:33 am
Here is my SCREEN 0 ghost animation.

Code: QB64: [Select]

I dare anyone to optimize it!

OK, Here's a bat...

Code: QB64: [Select]
  1. a$ = "^^0^^"
  2. b$ = "VV0VV"
  3.  
  4. FOR i = 25 TO 1 STEP -1
  5.     LOCATE i, 38
  6.     PRINT a$;
  7.     _DELAY .2
  8.     LOCATE , 38: PRINT b$;
  9.     _DELAY .1
  10.     LOCATE , 38: PRINT SPACE$(5)

Pete :D

I'm not only a QB Forum owner, I'm also a client!
Title: Re: 15 days for Halloween code challenge
Post by: bplus on October 15, 2018, 11:45:00 am
Here's a few more bats, probably need Windows for sound.
Title: Re: 15 days for Halloween code challenge
Post by: johnno56 on October 15, 2018, 04:02:58 pm
Pete,

It may not be the most efficient method, but it does the same thing, and a few bytes less...

a$ = "^^0^^"
b$ = "VV0VV"

FOR i = 25 TO 1 STEP -1
    LOCATE i, 38
    PRINT a$;
    _DELAY .2
    LOCATE , 38: PRINT b$;
    _DELAY .1
   CLS
NEXT
Title: Re: 15 days for Halloween code challenge
Post by: johnno56 on October 15, 2018, 04:18:07 pm
bplus,

The flight path of those bats look oddly familiar... I cannot quite put my finger on it... Never the less, still a great effect...
I tried to convert the 'wav' to 'ogg' but still no sound... Oh well... Still 'looks' good...

J
Title: Re: 15 days for Halloween code challenge
Post by: TempodiBasic on October 15, 2018, 05:03:03 pm
Hi Guys
here the screenshot of the first two challanger

Pete
 [ This attachment cannot be displayed inline in 'Print Page' view ]  

Bplus
 [ This attachment cannot be displayed inline in 'Print Page' view ]  

Waiting other challengers I thank Pete and Bplus.

As soon as I'll post my code....
yesterday I have been in war with CONST and _RGB so I cannot finish my little idea.
Title: Re: 15 days for Halloween code challenge
Post by: Pete on October 15, 2018, 07:50:33 pm
I think we should end the contest now, while BPlus has a lock on second place!
Title: Re: 15 days for Halloween code challenge
Post by: bplus on October 16, 2018, 03:44:11 pm
OK while we are waiting for TempodiBasic and others to finish their Halloween treats here is a puzzle. Count the number of times BAT appears in this Word Search, remember 8 directions to check...

Code: QB64: [Select]
  1. ABBBBBATBTAABTABTBBB
  2. TTTTAATATTTBTATABTAA
  3. BBAATTTBBTTAABBAAATT
  4. AATBAAAABTTBATBABAAT
  5. ABATTBATBTTTATTTTBTT
  6. BBTBATABTAAAAATTTTBA
  7. BBBATBAABTTTTBBBBABA
  8. TABABTTTABAATABTATBT
  9. TABBTTBBBBTATBTTTTBT
  10. TBAABTBBTAABBTTTAATT
  11. BAABBTTTAAABTBATBATA
  12. ATBBBABAABTBABTABTBB
  13. TTTTAABAAAAATTATBBBA
  14. TABTBAABABBABBAABBAA
  15. TBATTABABTTTATATTTBT
  16. BTBTTTTTBBBATTABAABB
  17. BBBTAABTBBATTAATAABT
  18. TTATBATTATBATATBBABT
  19. TTTBBBBBTBTATABTTBBA
  20. TBABBAATATTABTBATBBA
  21.  
Title: Re: 15 days for Halloween code challenge
Post by: bplus on October 16, 2018, 08:35:07 pm
Here's what I found in my Halloween bag:
Code: QB64: [Select]
  1. KTIREKITRATECCCRTIAKIRTTTTRRAR
  2. CTKRAAKCAIERIECITCRTTCTRKRITCT
  3. TTCARTTACIKKIKTRERETIKCTCICRER
  4. ERRTTATTTCTCTKIETAITTRKKCIECET
  5. AIEATREAIRRIRITRTTTTAKTIEREKTR
  6. ATTRATIECTREATTITARETRICKTIATI
  7. TTTRERTRTIRTRICKCAEKRITITTKARR
  8. TRRIRRETTTRICKTATEAITCCETARTIC
  9. RIATTERTKARATTTIRTATRTCRCRTKRE
  10. TETCATRTAETREATKTRICKKTREATRCI
  11. KTRRTRTCTETRTEKAATCTCIECTRKTCT
  12. TKKTTEIRAITTIEERERRITCCTTRRERR
  13. CATATRICKKCTKTETIRRTERTKTRCRTA
  14. TTTERCATTTKTITRKTAERTEERRTAERE
  15. RCIAKERRATARKRRRRCCTCRTIRTETKK
  16. TTRACRRCRCTEIRATCCREETRKTKTCRR
  17. EEIRITKTCTCARCRTTTKTITTTIRRRCK
  18. IIEETKETEARTTATRTRTRTRECTETEET
  19. ITREIREETACETECAITKIRKTKTKARTR
  20. CRRRTTIRITERTIRERRKATTCTRIRKAR
  21.  

Use your Word Search code to see how many TRICKs and how many TREATs, I have.
Title: Re: 15 days for Halloween code challenge
Post by: TempodiBasic on October 17, 2018, 05:20:57 am
Hi boys and girls
I remember to QB64's community that it lasts 13 days to the end of posting....

Good Coding

Title: Re: 15 days for Halloween code challenge
Post by: TempodiBasic on October 21, 2018, 02:20:30 pm
Quote
Hi boys and girls
I remember to QB64's community that
it lasts ten days to the end of challenge of Halloween

Post your code!
Title: Re: 15 days for Halloween code challenge
Post by: bplus on October 21, 2018, 05:18:22 pm
Hi TempodiBasic,

How is your's coming along?
Title: Re: 15 days for Halloween code challenge
Post by: SMcNeill on October 23, 2018, 05:19:54 pm
It's been a while since I got serious and decided to play around and make a game, so I thought I'd take it upon myself to give this challenge a try. 

Here's what I have so far.  Though it's nothing but the main intro screen, I think it shows a bit of the theme that I'm shooting for, for this little game.

At this point, I'm uncertain if I want to simply make it an enhanced-SCREEN 0 game, or if I want to go ahead and find a nice couple of sprite sets and plug them in to make it more of a graphical game.  I'm thinking with only about a week let to go, I'm just going to make a little screen 0 game and not worry so much about the graphics.

What I'm thinking at this moment is to make it a cross between pac-man and rogue.   Using set mazes and monsters, let the character try to find his way to the exit of the mazes, while trying to gather armor, weapons, money, and -- of course -- not get eat by the monsters.

Mazes will start out simple and steadily increase in difficultly and puzzles as we proceed through them.

Nothing too serious; I just thought I'd have a little fun with this for a bit.  Feel free to steal some/part/all of this if it's of any use in your own projects in the future. 

Game files here (7z archive): https://www.dropbox.com/s/og5ukisj6h8vv3h/Hallowmaze.7z?dl=0
Title: Re: 15 days for Halloween code challenge
Post by: TempodiBasic on October 24, 2018, 06:18:56 pm
@Steve
I have take a look and it is very interesting and cool.
I'm waiting for development....

It lasts 6 days....
Title: Re: 15 days for Halloween code challenge
Post by: TempodiBasic on October 28, 2018, 08:14:11 am
Hi Guys
I hope that you are using the lasting time to upset your creations....
and I am doing so.

I remember that it lasts only 4 days to post your contribute...

Good Coding waiting Halloween's results
Title: Re: 15 days for Halloween code challenge
Post by: SMcNeill on October 28, 2018, 10:24:42 am
Hi Guys
I hope that you are using the lasting time to upset your creations....
and I am doing so.

I remember that it lasts only 4 days to post your contribute...

Good Coding waiting Halloween's results

My project got postponed a bit.  The last couple of days haven't given me any time for doing much serious coding as I've been too busy trying to devirus the wife's computer.  Let me tell ya: she's got a talent for finding them!!

At this point, I'm thinking the only sensible thing to do is boot to a fresh Linux system, via CD or USB, then dig and search for her documents and pictures which she wants to save, and copy them to a quarantined drive, before finally fdisking and blanking the whole damn drive and then reinstalling Windows for her.

I dunno how she did it, but Windows is partitioned on a separate drive from her data files (D:\ instead of C:\), and yet she's managed to get BOTH drives infected with 2418 different versions of spyware, adware, malware, viruses, trojans, and keyloggers! 

The woman has a God-given talent, I'm telling ya!!
Title: Re: 15 days for Halloween code challenge
Post by: TempodiBasic on October 28, 2018, 11:31:14 am
Hi Steve
just to give a preview of your project
Title: Re: 15 days for Halloween code challenge
Post by: TempodiBasic on October 31, 2018, 04:52:09 pm
Last day to post your ideas and results about Halloween challenge...
see later!

Good Type Type Typing Code
:-)
Title: Re: 15 days for Halloween code challenge
Post by: FellippeHeitor on October 31, 2018, 04:52:55 pm
I apologize for not taking part in the challenge, Tempodi. Too much in my hands these days.

I hope more people submit entries! There's till midnight!
Title: Re: 15 days for Halloween code challenge
Post by: TempodiBasic on October 31, 2018, 05:05:28 pm
Also I am typing because yesterday  I got into a fight with alphatrasparency image. I am not a great graphic operator (I use LodePaint or GIMP 2). Now I just fight with _limit and flickering :-)
But at the end I think to win these issues!
Title: Re: 15 days for Halloween code challenge
Post by: Pete on October 31, 2018, 05:10:35 pm
@ Fell's reply: And by too much on his hands he means diapers. Don't worry Fell, potty training solves that, it just takes 1+ years.

That bat is all I've coded in the past couple of months. I've been up to a lot of political stuff with the mid-term elections here. That's hardly a hobby. It feels more like a fight to keep a decent life for family and their future. Still, I have not regained the interest in programming I used to have. I still have some projects of interest that are more business related, which I may take up next year. Until then, I'm afraid "bats" all for now.

Pete
Title: Re: 15 days for Halloween code challenge
Post by: TempodiBasic on October 31, 2018, 05:22:28 pm
Hi Pete
I'm sorry but a virus has modified your code....
Code: QB64: [Select]
  1. 'background
  2. CLS , 1
  3. RESTORE moon
  4. FOR a = 1 TO 13
  5.     FOR b = 1 TO 15
  6.         READ c
  7.         IF c = 1 THEN
  8.             LOCATE 6 + a, 10 + b
  9.             PRINT CHR$ (64)
  10.         END IF
  11.     NEXT
  12. COLOR 6, 6
  13. LOCATE 25, 1
  14. PCOPY 0, 1
  15.  
  16. a$ = "^^0^^"
  17. b$ = "VV0VV"
  18.  
  19. FOR i = 25 TO 1 STEP -1
  20.     IF i = 2 THEN i = 25
  21.     IF i = 25 THEN col = INT(RND * 75) + 1
  22.     PCOPY 1, 0
  23.     COLOR 15, 1
  24.     LOCATE 22, i: PRINT " Ü ";
  25.     LOCATE 23, i: PRINT "ÛìÛ";
  26.     LOCATE 24, i: PRINT "ÛÛÛ";
  27.     COLOR 7, 1
  28.     LOCATE i, col
  29.     PRINT a$;
  30.     _DELAY .2
  31.     LOCATE , col: PRINT b$;
  32.     _DELAY .1
  33.     COLOR 15, 1
  34.     LOCATE 22, i: PRINT "   ";
  35.     LOCATE 23, i: PRINT "   ";
  36.     LOCATE 24, i: PRINT "   ";
  37.     COLOR 7, 1
  38.  
  39.     LOCATE , col: PRINT SPACE$(5)
  40.  
  41. 'matrix 15x13 for moon
  42. moon:
  43. DATA 0,0,0,0,1,1,1,1,1,1,1,1,1,0,0
  44. DATA 0,0,0,1,1,1,1,1,1,1,1,1,1,1,0
  45. DATA 0,0,1,1,1,1,1,1,1,1,0,0,1,1,0
  46. DATA 0,0,1,1,1,1,1,1,1,0,0,0,1,1,1
  47. DATA 0,1,1,1,1,1,1,0,0,0,0,0,0,1,1
  48. DATA 1,1,1,1,1,1,1,0,0,0,0,0,0,0,0
  49. DATA 1,1,1,1,1,1,0,0,0,0,0,0,0,0,0
  50. DATA 0,1,1,1,1,1,0,0,0,0,0,0,0,0,0
  51. DATA 0,0,1,1,1,1,1,0,0,0,0,0,0,0,0
  52. DATA 0,0,1,1,1,1,1,1,0,0,0,0,0,0,0
  53. DATA 0,0,0,1,1,1,1,1,1,0,0,0,0,1,1
  54. DATA 0,0,0,0,1,1,1,1,1,1,1,1,1,1,0
  55. DATA 0,0,0,0,0,1,1,1,1,1,1,1,1,0,0
  56.  

and I got this screenshot attached

I'm sorry, it seems that AVAST do not avast  (in my local dialect avast = it is not enough) !
Title: Re: 15 days for Halloween code challenge
Post by: SMcNeill on October 31, 2018, 05:25:24 pm
I'm just a guy easily distracted by other........   LOOK!  BOOBIES!!!

... Now, wait a moment...  Where was I?  OH, right!  I was saying I was easy distrac...

DID YOU SEE THAT CAT VIDEO??  No??  Well, nevermind.  What was I talking about?  Oh yeah!  My QBDbas...

Sorry.  I had to let the dog go pee...

But, as I was saying, "Have you seen the changes to CONST?  Or the bug fixes I was wooooorrr.....

BOOBIES!!  AGAIN!!

You know, I wouldn't have these issues if my wife wouldn't walk around topless half the tiiiiiimmmmeee.....

HI honey!  You know, I just love it when you lean over my shoulder and look at what I'm typing, while you're dressed like thaaaa....

....umm.....ummm..... 

Sorry guys.  I gotta go.  The wife needs my help in the bedroom for a while..  We can talk about ....  whatever it was....

Later.
Title: Re: 15 days for Halloween code challenge
Post by: Pete on October 31, 2018, 05:40:04 pm
Quote
Sorry guys.  I gotta go.  The wife needs my help in the bedroom for a while..  We can talk about ....  whatever it was....

Later.

Yeah, she needs you to go on a battery run!
Title: Re: 15 days for Halloween code challenge
Post by: STxAxTIC on October 31, 2018, 05:44:49 pm
Hahaha, this why I love Pete... always beats me to the zing and with a better one no less...
Title: Re: 15 days for Halloween code challenge
Post by: bplus on October 31, 2018, 05:48:52 pm
Oh rats! another mod from Bplus:
Code: QB64: [Select]
  1. _TITLE "Fake sphere mapping mod 2  2018-10-31 B+"
  2.  
  3. CONST WW = 800
  4. CONST WH = 600
  5. SCREEN _NEWIMAGE(WW, WH, 32)
  6.  
  7. map& = _NEWIMAGE(WW, WH, 32)
  8. _DEST map&
  9. LINE (0, 0)-(WW, WH), _RGB32(200, 100, 0), BF
  10. FOR i = 0 TO WW STEP WW / 12
  11.     LINE (i, 0)-(i + 1, WH), _RGB32(0, 0, 0), BF
  12.  
  13. k~& = _RGB32(255, 255, 0)
  14. ftri map&, WW / 2 - 100, WH / 3, WW / 2 - 100 - 25, WH / 3 + 50, WW / 2 - 100 + 25, WH / 3 + 50, k~&
  15. ftri map&, WW / 2 + 100, WH / 3, WW / 2 + 100 - 25, WH / 3 + 50, WW / 2 + 100 + 25, WH / 3 + 50, k~&
  16. ftri map&, WW / 2 - 25, WH / 3 + 100, WW / 2, WH / 3 + 150, WW / 2 + 25, WH / 3 + 100, k~&
  17.  
  18. ftri map&, WW / 2 - 50, WH / 3 + 125, WW / 2 - 55, WH / 3 + 130, WW / 2 - 200, WH / 3 + 80, k~&
  19. ftri map&, WW / 2 + 50, WH / 3 + 125, WW / 2 + 55, WH / 3 + 130, WW / 2 + 200, WH / 3 + 80, k~&
  20.  
  21. ftri map&, WW / 2 - 60, WH / 3 + 140, WW / 2 - 60, WH / 3 + 145, WW / 2 - 220, WH / 3 + 140, k~&
  22. ftri map&, WW / 2 + 60, WH / 3 + 140, WW / 2 + 60, WH / 3 + 145, WW / 2 + 220, WH / 3 + 140, k~&
  23.  
  24. ftri map&, WW / 2 - 60, WH / 3 + 160, WW / 2 - 55, WH / 3 + 165, WW / 2 - 220, WH / 3 + 210, k~&
  25. ftri map&, WW / 2 + 60, WH / 3 + 160, WW / 2 + 55, WH / 3 + 165, WW / 2 + 220, WH / 3 + 210, k~&
  26.  
  27. _PUTIMAGE , map&
  28.  
  29. r = WH / 3
  30. xc = WW / 2
  31. yc = WH / 2
  32. xo = 0
  33. COLOR , _RGB32(40, 0, 68)
  34.     CLS
  35.     FOR y = -r TO r
  36.         x1 = SQR(r * r - y * y)
  37.         tv = (_ASIN(y / r) + 1.5) / 3
  38.         FOR x = -x1 + 1 TO x1
  39.             tu = (_ASIN(x / x1) + 1.5) / 6
  40.             _SOURCE map&
  41.             pc~& = POINT((xo + tu * WW) MOD WW, tv * WH)
  42.             _DEST 0
  43.             PSET (x + xc, y + yc), pc~&
  44.         NEXT x
  45.     NEXT y
  46.     xo = xo + 1
  47.     xo = xo MOD WW
  48.     _DISPLAY
  49.     _LIMIT 60
  50.  
  51. ' found at [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]:    http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index.php?topic=14425.0
  52. SUB ftri (d&, x1, y1, x2, y2, x3, y3, K AS _UNSIGNED LONG)
  53.     a& = _NEWIMAGE(1, 1, 32)
  54.     _DEST a&
  55.     PSET (0, 0), K
  56.     _DEST d&
  57.     _MAPTRIANGLE _SEAMLESS(0, 0)-(0, 0)-(0, 0), a& TO(x1, y1)-(x2, y2)-(x3, y3)
  58.     _FREEIMAGE a& '<<< this is important!
  59.  
  60.  
Title: Re: 15 days for Halloween code challenge
Post by: Pete on October 31, 2018, 06:22:06 pm
Hahaha, this why I love Pete... always beats me to the zing and with a better one no less...

Thanks, but jokes like these have had some people considering me to be a misogynist, which is weird, because I have spent a lot of money in my adult life on battered women. They're just better deep fried. I mean who wouldn't prefer a well-"bread" woman over a boneless one, anyway?

@BPlus - Nice basketball, but why does it have a cat's face on it?
Title: Re: 15 days for Halloween code challenge
Post by: bplus on October 31, 2018, 07:25:06 pm
Some bats ate all the pumpkins.
Title: Re: 15 days for Halloween code challenge
Post by: TempodiBasic on October 31, 2018, 08:16:15 pm
Hi Guys  here my code
be patient downloading ZIP.

Your goal is to give sweet to not get the treat (spider)

Code: QB64: [Select]
  1. 'Music downloaded from  [No Copyright Music] Halloween - (Royalty Free Halloween Music)
  2. ' Images taken from Images downloaded from www.freepik.com
  3. '
  4. SCREEN _NEWIMAGE(800, 600, 32)
  5. _TITLE "Halloween Challenge"
  6. _SCREENMOVE 200, 20
  7.  
  8. DIM a AS LONG, b AS LONG, c AS LONG, d AS LONG, e(1 TO 9) AS LONG, f AS LONG, f2 AS LONG, g AS INTEGER
  9. DIM RightGo AS _BYTE, LeftGo AS _BYTE, FireActive AS _BYTE, ChangeMusic AS _BYTE, OffMusic AS _BYTE
  10. DIM Xpump(1 TO 9) AS INTEGER, Ypump(1 TO 9) AS INTEGER, xShip AS INTEGER, xFire AS INTEGER, yFire AS INTEGER
  11. DIM Fpump(1 TO 9) AS _BYTE, Lpump(1 TO 9) AS INTEGER, FireActiveP AS _BYTE, xFireP(1 TO 9) AS INTEGER, yFireP(1 TO 9) AS INTEGER
  12. DIM VelP AS INTEGER, GoDown AS _BYTE, path AS STRING, files$, cmd AS INTEGER, GameOver AS INTEGER
  13. DIM SHARED mus(1 TO 4) AS LONG, snd(1 TO 4) AS LONG, ActualMus AS LONG, IndexMus AS INTEGER
  14.  
  15. CONST RedBack = _RGB(210, 0, 0, 32), Color1 = _RGB(255, 255, 255, 32), Color2 = _RGB(255, 177, 0, 32), Color3 = _RGB(255, 150, 80, 32)
  16. CONST Color4 = _RGB(255, 100, 0, 32), Color5 = _RGB(255, 55, 0, 32), Color6 = _RGB(100, 130, 20, 32)
  17. CONST FireS = 4, FireP = 3, DeathS = 2, DeathP = 1
  18. CONST False = 0, True = -1, Quit = 999, Fire = 100, FireVel = 10, Right = 150, Left = 200, yShip = 500
  19. CONST CMusic = 250, OMusic = 300, widS = 100, higS = 100
  20.  
  21. ' inizialize fonts----------------------------------------------------------
  22. path$ = "C:\Windows\Fonts\"
  23. files$ = "Tahoma.ttf" '  "lucon.ttf"  <-- Alternative fonts of system
  24. loadfont path$ + files$, f, 68
  25. files$ = "seguihis.ttf"
  26. loadfont path$ + files$, f2, 36
  27.  
  28. ' initialize music and sounds------------------------------------------------
  29. loadMusic
  30.  
  31. ' initialize images----------------------------------------------------------
  32. a = _LOADIMAGE("assets_H\moon.jpg") 'BACKGROUND
  33. IF a >= -1 THEN PRINT "Image not loaded moon"
  34. b = _LOADIMAGE("assets_H\ship_.png") 'USER
  35. IF b >= -1 THEN PRINT "Image not loaded ship"
  36. c = _LOADIMAGE("assets_H\sweet.png") 'FIRE OF USER
  37. IF c >= -1 THEN PRINT "Image not loaded sweet"
  38. d = _LOADIMAGE("assets_H\spider.png") ' FIRE OF PUMPKINS
  39. IF d >= -1 THEN PRINT "Image not loaded spider"
  40. ' PUMPKINS
  41. FOR g = 1 TO 9 STEP 1
  42.     e(g) = _LOADIMAGE("assets_H\pum" + LTRIM$(STR$(g)) + ".png") ' FIRE OF PUMPKINS
  43.     IF e(g) >= -1 THEN PRINT "Image not loaded pum" + LTRIM$(STR$(g)) + ".png", e(g)
  44.     Xpump(g) = 80 * g: Ypump(g) = 70
  45.     Lpump(g) = True 'life
  46.     Fpump(g) = False 'firing
  47. VelP = 5 ' pumpkins go towards right
  48.  
  49. ' setting for starting------------------------------------------------------------
  50. _PUTIMAGE (1, 1)-(800, 600), a
  51. Credits
  52. IntroStart f, f2
  53. xShip = 200
  54. GoDown = False
  55. GameOver = 0
  56. m = _NEWIMAGE(800, 600, 32)
  57. 'main loop
  58.  
  59.     cmd = 0 ' clear buffer commands
  60.     '---------------------------INPUT MANAGEMENT--------------------------------
  61.     ' take commands
  62.     IF _KEYDOWN(32) AND FireActive = 0 THEN cmd = Fire
  63.     IF _KEYDOWN(27) THEN cmd = quits
  64.     IF _KEYDOWN(19200) THEN cmd = Right
  65.     IF _KEYDOWN(19712) THEN cmd = Left
  66.     IF _KEYDOWN(77) OR _KEYDOWN(109) THEN cmd = CMusic
  67.     IF _KEYDOWN(13) AND (_KEYDOWN(77) OR _KEYDOWN(109)) THEN cmd = OMusic
  68.  
  69.     '---------------------------COMMAND TRANSLATOR------------------------------
  70.     ' command Fire
  71.     IF cmd = Fire THEN
  72.         FireActive = True
  73.         yFire = yShip
  74.     END IF
  75.     ' command go right
  76.     IF cmd = Right THEN RightGo = True ELSE RightGo = False
  77.     ' command go left
  78.     IF cmd = Left THEN LeftGo = True ELSE LeftGo = False
  79.     ' command change music
  80.     IF OffMusic = False AND cmd = CMusic THEN ChangeMusic = True
  81.     ' command off music
  82.     IF cmd = OMusic THEN OffMusic = NOT OffMusic
  83.  
  84.  
  85.     '-------------------------EVENT MANAGEMENT-----------------------------------
  86.  
  87.     ' event Fire  @----------------------------------------------
  88.     IF FireActive THEN
  89.         IF yFire = yShip THEN _SNDPLAY snd(FireS): xFire = xShip + INT(widS / 2) - 20
  90.         IF yFire - FireVel > 0 THEN
  91.             yFire = yFire - FireVel
  92.         ELSE
  93.             yFire = 0
  94.             FireActive = False
  95.         END IF
  96.     END IF
  97.  
  98.     ' event go to right  @----------------------------------------------
  99.     IF RightGo THEN
  100.         IF xShip - 10 < 1 THEN xShip = 1 ELSE xShip = xShip - 10
  101.         RightGo = False
  102.     END IF
  103.  
  104.     ' event go to left  @----------------------------------------------
  105.     IF LeftGo THEN
  106.         IF xShip + 10 + widS > 800 THEN xShip = 800 - widS ELSE xShip = xShip + 10
  107.         LeftGo = False
  108.     END IF
  109.  
  110.  
  111.     ' event  change music   @----------------------------------------------
  112.     IF ChangeMusic = True THEN
  113.         IF IndexMus = 4 THEN IndexMus = 1 ELSE IndexMus = IndexMus + 1
  114.         _SNDSTOP ActualMus
  115.         ActualMus = mus(IndexMus)
  116.         _SNDPLAY ActualMus
  117.         ChangeMusic = False
  118.     END IF
  119.  
  120.     ' event Off music  @----------------------------------------------
  121.     IF OffMusic = True THEN _SNDSTOP ActualMus
  122.  
  123.     ' event end music on playing  @----------------------------------------------
  124.     IF _SNDPLAYING(ActualMus) = False THEN _SNDPLAY ActualMus
  125.  
  126.     ' event Move Pumpkins  @----------------------------------------------
  127.     IF VelP > 0 THEN ' moving to right
  128.         FOR j = 9 TO 1 STEP -1
  129.             IF Lpump(j) = True THEN EXIT FOR
  130.         NEXT
  131.         IF Xpump(j) + VelP + 60 > 800 THEN
  132.             VelP = VelP * -1 ' it changes direction
  133.             GoDown = True ' pumpkins go towards ship
  134.         ELSE
  135.             GoDown = False
  136.         END IF
  137.     ELSE 'moving to left
  138.         FOR j = 1 TO 9 STEP 1
  139.             IF Lpump(j) = True THEN EXIT FOR
  140.         NEXT
  141.         IF Xpump(j) + VelP < 0 THEN
  142.             VelP = VelP * -1 ' it changes direction
  143.             GoDown = True ' pumpkins go towards ship
  144.         ELSE
  145.             GoDown = False
  146.         END IF
  147.     END IF
  148.     ' it calculates the new position for pumpkins
  149.     FOR k = 1 TO 9 STEP 1
  150.         IF Lpump(k) = True THEN
  151.             Xpump(k) = Xpump(k) + VelP
  152.             IF GoDown = True THEN Ypump(k) = Ypump(k) + 10
  153.         END IF
  154.     NEXT
  155.  
  156.     ' event Fire Pumpkins  @----------------------------------------------
  157.     FOR h = 1 TO 9 STEP 1
  158.         IF Lpump(h) = True THEN ' if pumpkin exists
  159.             IF (INT(RND * 3) + 1) > 2 THEN
  160.                 IF Fpump(h) = False THEN 'if pumpkin is not firing
  161.                     Fpump(h) = True ' it starts to fire
  162.                     yFireP(h) = Ypump(h)
  163.                 END IF
  164.             END IF
  165.         END IF
  166.  
  167.         ' event firing pumpkins       @----------------------------------------------
  168.         IF Fpump(h) = True THEN
  169.             IF yFireP(h) = Ypump(h) THEN _SNDPLAY snd(FireP): xFireP(h) = Xpump(h) + INT(widS / 2) - 20
  170.             IF yFireP(h) + FireVel < 600 THEN
  171.                 yFireP(h) = yFireP(h) + FireVel
  172.             ELSE
  173.                 yFireP(h) = 540
  174.                 Fpump(h) = False
  175.             END IF
  176.         END IF
  177.         ' event destroy ship       @----------------------------------------------
  178.         IF (xFireP(h) > xShip AND xFireP(h) < xShip + widS) OR (xFireP(h) + 40 > xShip AND xFireP(h) + 40 < xShip + widS) THEN
  179.             IF (yFireP(h) > yShip AND yFireP(h) < yShip + higS) OR (yFireP(h) + 20 > yShip AND yFireP(h) + 20 < yShip + higS) THEN
  180.                 _SNDPLAY snd(2)
  181.                 cmd = Quit
  182.             END IF
  183.         END IF
  184.         ' event destroy fireship   @----------------------------------------------
  185.         IF (xFireP(h) >= xFire AND xFireP(h) <= xFire + 40) OR (xFireP(h) + 40 >= xFire AND xFireP(h) + 40 <= xFire + 40) THEN
  186.             IF (yFireP(h) >= yFire AND yFireP(h) <= yFire + 20) OR (yFireP(h) + 20 >= yFire AND yFireP(h) + 20 <= yFire + 20) THEN
  187.                 _SNDPLAY snd(1)
  188.                 Fpump(h) = False
  189.                 FireActive = False
  190.             END IF
  191.         END IF
  192.  
  193.     NEXT
  194.  
  195.     ' event destroy pumpkin @----------------------------------------------
  196.     IF FireActive THEN
  197.         FOR l = 1 TO 9 STEP 1
  198.             IF Lpump(l) = True THEN ' pumpkins is alive
  199.                 IF (xFire > Xpump(l)) AND (Xpump(l) + 60 > xFire) OR (xFire + 40 > Xpump(l)) AND (Xpump(l) + 60 > xFire + 40) THEN
  200.                     IF (yFire < Ypump(l) + 60) AND (yFire > Ypump(l)) OR (yFire + 20 < Ypump(l) + 60) AND (yFire + 20 > Ypump(l)) THEN
  201.                         Lpump(l) = False
  202.                         FireActive = False
  203.                         GameOver = GameOver + 1
  204.                         _SNDPLAY snd(1)
  205.                     END IF
  206.                 END IF
  207.             END IF
  208.         NEXT
  209.     END IF
  210.  
  211.  
  212.     '-----------------------------------------OUTPUT --------------------
  213.     ' all graphic operations go onto hidden panel m
  214.     _PUTIMAGE (1, 1)-(800, 600), a, m 'background layer
  215.     _PUTIMAGE (xShip, yShip)-(xShip + widS, yShip + higS), b, m ' astroship layer
  216.     IF FireActive THEN _PUTIMAGE (xFire, yFire)-(xFire + 40, yFire + 20), c, m ' FireShip
  217.     FOR i = 1 TO 9 STEP 1
  218.         IF Lpump(i) THEN _PUTIMAGE (Xpump(i), Ypump(i))-(Xpump(i) + 60, Ypump(i) + 60), e(i), m
  219.         IF Fpump(i) THEN _PUTIMAGE (xFireP(i), yFireP(i))-(xFireP(i) + 40, yFireP(i) + 20), d, m
  220.     NEXT
  221.     _PUTIMAGE , m, 0 'copy panel m to screen
  222.     _LIMIT 10
  223.  
  224.     'debug
  225.  
  226.  
  227. LOOP UNTIL GameOver = 9 OR cmd = Quit ' events GameOver and Quit
  228. IF GameOver = 9 THEN
  229.     _SNDPLAY snd(1)
  230.     CLS
  231.     PRINT "YOU WIN"
  232.     PRINT "GAME OVER"
  233.     SLEEP 5
  234. IF cmd = Quit THEN
  235.     _SNDPLAY snd(2)
  236.     CLS
  237.     PRINT "YOU LOOSE"
  238.     PRINT "GAME OVER"
  239.     SLEEP 5
  240.  
  241.  
  242. SUB IntroStart (fn1&, fn2&)
  243.     DIM cont%
  244.     FOR cont% = 1 TO 2 STEP 1
  245.         IF cont% = 1 THEN
  246.             CLS
  247.             IF fn2& > 0 THEN _FONT fn2& ELSE PRINT "No file font loaded" + " seguihis.ttf"
  248.             COLOR Color6
  249.             _PRINTSTRING (260, 200), "Press a key to start"
  250.         ELSE
  251.             CLS , RedBack
  252.             _FONT fn1&
  253.             COLOR Color1
  254.             _PRINTSTRING (30, 120), "INSTRUCTIONS:"
  255.             _PRINTSTRING (30, 200), "space = fire"
  256.             _PRINTSTRING (30, 250), "arrows left/right = move"
  257.             _PRINTSTRING (30, 300), "M = change music"
  258.             _PRINTSTRING (30, 350), "Enter+M =Off/On music"
  259.             _PRINTSTRING (30, 410), "ESC to quit"
  260.         END IF
  261.         IF fn1& > 0 THEN _FONT fn1& ELSE PRINT "No file font loaded" + " Tahoma.ttf"
  262.         COLOR Color1
  263.         _PRINTSTRING (2, 20), "HALLOWEEN CHALLENGE", 0
  264.         COLOR Color2
  265.         _PRINTSTRING (6, 28), "HALLOWEEN CHALLENGE", 0
  266.         COLOR Color3
  267.         _PRINTSTRING (10, 36), "HALLOWEEN CHALLENGE", 0
  268.         COLOR Color4
  269.         _PRINTSTRING (14, 40), "HALLOWEEN CHALLENGE", 0
  270.         COLOR Color5
  271.         _PRINTSTRING (18, 44), "HALLOWEEN CHALLENGE", 0
  272.         IF cont% = 1 THEN SLEEP ELSE SLEEP 4
  273.     NEXT cont%
  274.  
  275. SUB loadfont (pat$, h&, size)
  276.     IF _FILEEXISTS(pat$) THEN
  277.         h& = _LOADFONT(pat$, size, "BOLD")
  278.     ELSE
  279.         PRINT "File font not found"
  280.     END IF
  281.  
  282. SUB Credits
  283.     DIM cp AS STRING
  284.     COLOR Color4
  285.     _FONT 16
  286.     PRINT "CREDITS:"
  287.     cp = " MUSIC: downloaded from  [No Copyright Music] Halloween - (Royalty Free Halloween Music)" + CHR$(13) + "  on www.youtube.com"
  288.     LOCATE 2, 2
  289.     PRINT cp
  290.     cp = " IMAGES: downloaded from freepik.com created: Pumpkin and Starship by Freepik, Moon by Kjpargeter,  Sweet and spider by Titusurya"
  291.     PRINT cp
  292.     LOCATE 12, 2
  293.     PRINT "PRESS A KEY TO CONTINE..."
  294.     SLEEP
  295.     CLS
  296.  
  297. SUB loadMusic
  298.     SHARED OffMusic AS _BYTE
  299.     DIM a AS INTEGER
  300.     CLS
  301.     LOCATE 2, 2
  302.     PRINT "LOADING MUSIC....."
  303.     mus(1) = _SNDOPEN("assets_H\UnknownFear.mp3")
  304.     mus(2) = _SNDOPEN("assets_H\Halloween.mp3")
  305.     mus(3) = _SNDOPEN("assets_H\WonderAndMagic.mp3")
  306.     mus(4) = _SNDOPEN("assets_H\Spook.mp3")
  307.     FOR a = 1 TO 4 STEP 1
  308.         IF mus(a) = 0 THEN PRINT "No music " + STR$(a) + " found!"
  309.     NEXT
  310.     _SNDPLAY mus(a - 1) ' it plays the last music loaded
  311.     ActualMus = mus(a - 1)
  312.     OffMusic = False
  313.     PRINT
  314.     PRINT "LOADING SOUND....."
  315.     snd(1) = _SNDOPEN("assets_H\DeathPump.mp3")
  316.     snd(2) = _SNDOPEN("assets_H\DeathShip.mp3")
  317.     snd(3) = _SNDOPEN("assets_H\FirePump.mp3")
  318.     snd(4) = _SNDOPEN("assets_H\FireShip.mp3")
  319.     FOR a = 1 TO 4 STEP 1
  320.         IF snd(a) = 0 THEN PRINT "No music " + STR$(a) + " found!"
  321.     NEXT
  322.     SLEEP 2
  323.     CLS
  324.  
  325. FUNCTION quits
  326.     DIM a$
  327.     COLOR , 0
  328.     _PRINTSTRING (200, 200), "Do you Quit?"
  329.     _PRINTSTRING (300, 260), "Y/N"
  330.     DO
  331.         a$ = LCASE$(INPUT$(1))
  332.     LOOP UNTIL a$ = "y" OR a$ = "n"
  333.     IF a$ = "y" THEN quits = Quit ELSE quits = False

Thanks to try
Title: Re: 15 days for Halloween code challenge
Post by: TempodiBasic on October 31, 2018, 08:21:35 pm
If you find too huge .ZIP here 2 screenshots


About midnight... someoneelse can post somethingelse before his/her midnight... it can be...
Title: Re: 15 days for Halloween code challenge
Post by: TempodiBasic on October 31, 2018, 08:56:34 pm
@Bplus

Fine your rotating sphere  :-)
Title: Re: 15 days for Halloween code challenge
Post by: Pete on October 31, 2018, 09:04:03 pm
ROFL. It went from a basketball to a sphere... anything but a pumpkin!

Pete