Computer Science Canada

[RPG Game] Trouble with variables using another Font.

Author:  J-son [ Thu Oct 24, 2013 8:31 pm ]
Post subject:  [RPG Game] Trouble with variables using another Font.

Alright. Using the latest version of Turing - Started programming 1 month ago.

I need help with inputting variables into a different Font.
Example, normally:

var Clash : int
var intfont2 : int
intfont2 := Font.New ("Garamond:10")
Font.Draw ("Clashed: ", 100, 100, intfont2, 54) % Cannot insert variable

The problem.. how do I insert the variable?

(For damage to appear in the game.)




EDIT: Discovered an answer.. sorry for asking.
http://compsci.ca/v3/viewtopic.php?t=5354



How it worked:
code:

var intfont : int := Font.New ("Garamond:10")
var Display : string
var Attacked : real
var Floatx : int := 570
var Floaty : int := 270
var Timer : int := 0

% Blah blah attack and stuff

EnemyHp :=EnemyHp - Attacked
Display:= realstr Attacked,4)
loop
    Timer += 10
    Font.Draw (Display+ "",Floatx,Floaty,intfont,39)
    delay (70 + Timer)
    Font.Draw (Display+ "", Floatx,Floaty, intfont, 0)
    Floatx -= 2
    Floaty += 1
    exit when Floaty >= 291
end loop


Author:  Raknarg [ Fri Oct 25, 2013 9:46 am ]
Post subject:  RE:[RPG Game] Trouble with variables using another Font.

For future reference, to make your life easier, you can do this:

[sytax="turing"]

<Put your code in here>

[/syntax]
*except spell syntax correctly

This will make a window like this on your page:

Turing:

var Clash : int
var intfont2 : int
intfont2 := Font.New ("Garamond:10")
Font.Draw ("Clashed: ", 100, 100, intfont2, 54) % Cannot insert variable


: