News:

Function Finder  Find all the functions within source code files

Main Menu

From my Merlin's Mystical Magic series - Puzzle 2

Started by geecee, March 14, 2009, 06:37:03 PM

Previous topic - Next topic

geecee

This is the second of the puzzles from my Merlin's Wide and Wonderful World of Mystical Magic series.

The code has been updated.

I have posted the code here but it, and the necessary media, is in the attached Mystical Magic Puzzle 2.zip file.

PlayBASIC Code: [Select]
remstart
=======================================================
Puzzles from my Merlin's Wide and Wonderful World
of Mystical Magic
*************************************************
Author: geecee
Originally written for Dark Basic - October 2007
Rewritten for Play Basic - March 2009
Revised - April 2009
*************************************************
Puzzle Number 2
=======================================================
remend


rem Pre-Load Required Fonts
font1=loadNewfont("arial bold",20,0)
font2=loadNewfont("arial bold",40,0)
font3=loadNewfont("arial bold",100,0)

rem Pre-Load Media
BaseImage =LoadNewImage("Base.bmp")
Card1Image =LoadNewImage("card1.bmp")
Card2Image =LoadNewImage("card2.bmp")
Card3Image =LoadNewImage("card3.bmp")
Card4Image =LoadNewImage("card4.bmp")
Card5Image =LoadNewImage("card5.bmp")
Card6Image =LoadNewImage("card6.bmp")
CardRedImage =LoadNewImage("cardred.bmp")
CardBlueImage =LoadNewImage("cardblue.bmp")
CardBlankImage =LoadNewImage("cardblank.bmp")

rem This command will hide the mouse pointer
mouse off

rem ---------------------------------------------------
rem Start of programme main loop
rem ---------------------------------------------------

Do

rem Set text style and size
setfont font1

rem Determine height of font
fontheight=gettextheight("arial bold")

rem Declare array/s
dim chosen(6)

rem Set new ink colour
ink rgb(255,217,128)

rem Display an image
drawImage BaseImage,0,0,false

rem Display screen
sync

rem A short wait before proceeding
wait 1000

rem Determine width of longest text line and divide it by 2
rem Set across and down coordinates
rem Write text to screen
tw=gettextwidth("Welcome to my Wide and Wonderful World of Mystical Magic.")/2
across=300-tw:down=315
text across,down,"Hello! My name is Merlin."
text across,down+fontheight*2,"Welcome to my Wide and Wonderful World of Mystical Magic."

rem Display screen
sync

rem A short wait before proceeding
wait 1000

rem Draw a box to hide previous text at location
boxc 2,315,580,315+fontheight*4,1,rgb(255,0,0)

rem A short wait before proceeding
wait 500

rem ---------------------------------------------------
rem Deal 6 cards face down
rem ---------------------------------------------------

rem Write text to screen
centertext 300,150,"I will deal six cards face down"

rem Draw a box to hide previous text at location
boxc 2,315,580,315+fontheight*1,1,rgb(255,0,0)

rem Display screen
sync

rem A short wait before proceeding
wait 1000

rem Determine card back from 2 designs
cardback=rnd(1)+1

rem Draw card images with a short wait between
for place=1 to 6
if place=1 or place=4 then across=23
if place>=1 and place<=3 then across=across+112:down=207
if place>=4 and place<=6 then across=across+112:down=357
if cardback=1 then drawImage CardRedImage,across,down,false
if cardback=2 then drawImage CardBlueImage,across,down,false
sync
wait 50
next place

rem ---------------------------------------------------
rem Choose any card
rem ---------------------------------------------------

rem Draw a box to hide previous text at location
boxc 2,150,580,150+fontheight*1,1,rgb(255,0,0)

rem A short wait before proceeding
wait 1000

rem Write text to screen
centertext 300,150,"Choose a card and click on it"

rem Display screen
sync

rem This command will show the mouse pointer
mouse on

rem Go to subroutine to check card
gosub checkselection

rem This command will hide the mouse pointer
mouse off

rem ---------------------------------------------------
rem Turn card over
rem ---------------------------------------------------

rem Draw a box to hide previous text at location
boxc 2,150,580,150+fontheight*1,1,rgb(255,0,0)

rem A short wait before proceeding
wait 1000

rem Write text to screen
centertext 300,150,"I will turn your card over"
Login required to view complete source code


:)
Enjoy
geecee

Others from my Merlin's Wide and Wonderful World of Mystical Magic series

Merlin's Mystical Magic series - Puzzle 1
Merlin's Mystical Magic series - Puzzle 3
Merlin's Mystical Magic series - Magical card Predictor
LANG MEY YER LUM REEK

A smile costs less than electricity and gives more light :)

geecee

Hi there!

The original posting has been updated

:)
geecee
LANG MEY YER LUM REEK

A smile costs less than electricity and gives more light :)

geecee

Hi there!

Did anyone have any problems with the programme ...... Like when you chose the first number on any of the cards?

I would be interested to know.

Thanks.

:)
geecee
LANG MEY YER LUM REEK

A smile costs less than electricity and gives more light :)

geecee

Hi there!

No problems? ...... That's interesting.

:)
geecee
LANG MEY YER LUM REEK

A smile costs less than electricity and gives more light :)