News:

Function Finder  Find all the functions within source code files

Main Menu

From my Merlin's Mystical Magic series - Puzzle 3

Started by geecee, May 05, 2009, 08:29:38 PM

Previous topic - Next topic

geecee

Hi there!

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

I have posted the code here but it, and the necessary media, is in the attached Mystical Magic Puzzle 3.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 - May 2009
*************************************************
Puzzle Number 3
=======================================================
remend


rem ==========================================================================
rem Initialise programme
rem ==========================================================================

rem Tell PB to include the input support library
#include "Input"

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

rem Pre-Load Required Media
BaseImage=LoadNewImage("Base.bmp")

rem This command will hide the mouse pointer
mouse off

rem Set text style and size
setfont font1

rem Determine text height
height=gettextheight("arial bold")

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

rem ==========================================================================
rem Programme Introduction
rem ==========================================================================

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

rem Write text to screen
centertext 300,270,"Hello! My name is Merlin. "
centertext 300,300,"Welcome to my Wide and Wonderful World"
centertext 300,330,"of Mystical Magic."
centertext 300,500,"Click mouse to start."

rem Display screen
sync

rem Wait for mouse click
Waitmouse false, (1+2)
mb=mousebutton()

rem Wait until the mouse button is released
WaitNoInput

rem This do .. loop calls all the procedures in turn to play the game.
do
gosub play_game
gosub play_again
loop

rem End programme
end

rem ================================================================
rem Play game subroutine
rem ================================================================
play_game:

rem ---------------------------------------------------
rem Select a number from 1 to 99
rem ---------------------------------------------------

rem Draw a box to hide previous text at location
boxc 2,130,590,598,1,rgb(255,0,0)

rem Display screen
sync

rem A short wait before proceeding
wait 500

rem Write text to screen
centertext 300,182,"Click mouse to select a number from 1 to 99"

rem Display screen
sync

rem A short wait before proceeding
wait 500

rem Set across and down coordinates
across=300:down=224

rem Until mouse is clicked
repeat

rem Draw a box to hide previous text at location
boxc 290,224,310,244,1,rgb(255,0,0)

rem Determine random number
number=rnd(98)+1
chosennumber$=str$(number)

rem Write chosen number to screen
centertext across,down,chosennumber$

rem Display screen
sync

until mousebutton()=1 or mousebutton()=2

rem Write text to screen
centertext 300,203+height*3,"You have chosen number "+chosennumber$

rem Display screen
sync

rem A short wait before proceeding
wait 500

rem ---------------------------------------------------
rem Multiply by 2
rem ---------------------------------------------------

rem Write text to screen
centertext 300,203+height*5,"Multiply "+chosennumber$+" by 2, write down the answer, and click mouse"

rem Display screen
sync

rem A short wait before proceeding
wait 500

rem Wait for mouse click
Waitmouse false,(1+2)
mb=mousebutton()

rem ---------------------------------------------------
rem Add five
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 2
Merlin's Mystical Magic series - Magical card Predictor
LANG MEY YER LUM REEK

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