Computer Science Canada

Transparent Color for text?

Author:  hamid14 [ Sat Oct 17, 2009 6:45 pm ]
Post subject:  Transparent Color for text?

I am using turing 4.1. I am trying to learn about using images in turing. I have an image in background and I want to make the text background transparent, so it blends in with the picture but can be seen. Here is the code;

var background1 : int := Pic.FileNew("back1.BMP")
Pic.Draw (background1, 0, 9, 2)
colour(54)
colourback(0)
put "This is a test of text."
put "Hello World! I have learnt how to use pictures in Turing!"

Author:  Tony [ Sat Oct 17, 2009 6:56 pm ]
Post subject:  RE:Transparent Color for text?

Font.Draw

Author:  hamid14 [ Sat Oct 17, 2009 7:43 pm ]
Post subject:  Re: Transparent Color for text?

I can't use that like I use my put command. I tried this, but it doesnt work. I want to be able to draw variables on the screen as text. I tried putting in commas, but then it said too many commas, and then something about wrong arguments. What do I do?


var background1 : int := Pic.FileNew("back1.BMP")
var font1 : int
font1 := Font.New("comicsans:12")
Pic.Draw (background1,0,0, picUnderMerge)

var health : int := 30
var magic : int := 30
var action : string
var redpotion : int := 5
var bluepotion : int := 5
var expnow : int := 0
var experiencePoints : int
var gold : int := 30
var damage : int := Rand.Int(5,8)

%Enemy 1 variables
var enemy1HP : int := 10
var enemy1Dmg : int := Rand.Int(3,4)
var expnow1 : int := Rand.Int(5,10)

%Procedure experience1
proc experience1
gold += enemy1Dmg * 2
expnow += expnow1
put "You have ", expnow1, " experience points and ", gold, " GOLD."
end experience1

%Procedure Defend1
proc defend1
put "You chose to defend, the enemy attacked you!"
health := health - enemy1Dmg
if magic = 30 then
put "Your magic is full! Defend cannot recharge your MP!"
elsif magic > 30 then
magic += 4
put "You recovered 4 MP!"
end if
end defend1

%Battle start
proc battle1
loop
if enemy1HP < 0 then exit
elsif enemy1HP = 0 then exit
else
Font.Draw ("HP = ", health,3,380,font1)
put "HP = ", health, " MP = ", magic, " EXP = ", expnow, " GOLD = ", gold
put "The enemy has ", enemy1HP, " health points. Type atk to attack, def to defend."
get action
if action = "atk" then
put "You attacked the monster!"
enemy1HP -= damage
put "The monster has ", enemy1HP, " health points. The enemy attacked you!"
health -= enemy1Dmg
elsif action = "def" then
defend1
end if
end if
end loop
end battle1

battle1
experience1
put "You won the battle!"

Author:  Tony [ Sat Oct 17, 2009 8:35 pm ]
Post subject:  RE:Transparent Color for text?

commas separate arguments. So anything after the first comma is interpreted as x, then y, then fontID, etc. If you read the documentation (linked to in my previous post) you'll see that you can only pass it a single string.


: