Main Menu

Sponsored Links


Web Cartoon Maker: a Fun Way to Learn C++ Contents Previous Next

Hello World (as promised)

Ok, an empty cartoon is easy. But can we make a cartoon which does something. Sure! Here is an example of simple cartoon displaying text "Hello World" for one second:

void Scene1 ()


// declare a text object

Text MyText ( "Hello World" );

// make it visible

MyText.SetVisible ( true );


Let's look more closely on this example. The lines beginning with // are just comments. A comment is a bit of English text that you can put in the middle of a program, usually to explain what the program does. When the compiler sees a //, it ignores everything from there until the end of the line. The 2 lines beginning with // do nothing – but are very useful for understanding the operation or the program. Good programming technique makes liberal use of comments.

The following line: Text MyText ( "Hello World" ); is our first real statement. First word Text indicates that there will be a text object in our scene. What is an object? Imagine you making a real movie and you want to shoot a table, a chair, a car or something else in your movie. These are all objects! When you are making an animated cartoon, the line of text is also an object. You can do something with objects. You can move a table, sit on a chair or drive a car… You can even drive your car away from camera! You can also do a lot of things with a text object in an animated cartoon. You can make text visible and invisible, you can move, scale and rotate it and do other stuff. You will learn how to do this later.

The word MyText is a unique name for your object. For example if you shoot a movie you may have 2 chairs in front of your camera. And if you want an actor to sit on a chair you will need to specify on which one. You should say something like "Sit on the left chair please". MyText is something similar to "left chair". You may have many text objects in your scene and if you want to do something with one of them then you need a way to specify with which one. Word MyText (this could actually be almost any other word) will be used later to work with the text object.

The text inside parentheses indicates parameters of your text object. It this case this is just a text to display. As you will see later, this is a string value and it must be enclosed in double quotes by C++ standard.

The sentence, like most of the C++ sentences, is terminated with a semi-colon symbol.

Note: Forgetting semi-colons and non-matching braces or brackets are probably the two most common syntax errors made when first writing a program.

The next line MyText.SetVisible ( true ); is also a statement. You already know that MyText is the name of a text object. A dot after an object name in this case means that an instruction of what to do with an object will follow. Such instruction is called method . Different objects may have different methods for working with them. The method name in our case is SetVisible . It has a parameter true inside parentheses. As we will see later this is a boolean (or bool ) variable which can be either true or false . If the parameter is true then we are going to make an object visible. If it is false then the object is going to be hidden. We use the method SetVisible with parameter true to make our text object visible. By default all objects are invisible, because most of the times you need to use only some of the objects in your scene while other objects are hidden.

Note: The poor dot or period (.), while not an operator (at least in C++) is one of the most overloaded characters there is. (Overloading in general will be discussed later.) It can be a sentence delimiter, the decimal point in a floating point number or, as used in the above paragraph, part of the “dot naming” convention. In general, that convention means the text to the right of the dot is somehow associated with the object to the left of the dot – either as a function operating on the object or as a sub-object of the object.

Contents Previous Next

New Tales Animator Video by Alan Sturgess

Alan Sturgess shared an excellent video he made using Tales Animator! You can still download Tales Animator here. Unfortunately it is only available for Wi


Simple Online Character Designer

There is a prototype of simple online character designer available HERE. It is only a prototype, it does not contain many pieces yet but it can already generat


Book is updated

Now our book "Web Cartoon Maker: A Fun Way to Learn C++" is fully in synch with WCM 1.5! It is available for download and online reading HERE.


Web Cartoon Maker 1.5 is here!

Web Cartoon Maker 1.5 is finally here! You can download it HERE! Here is what was updated in version 1.5: Web Cartoon Maker Desktop Edition is now fully standal


read more news...