Web Cartoon Maker A Fun Way To Learn C -Books Pdf

Web Cartoon Maker a Fun Way to Learn C
19 Jan 2020 | 29 views | 0 downloads | 121 Pages | 6.25 MB

Share Pdf : Web Cartoon Maker A Fun Way To Learn C

Download and Preview : Web Cartoon Maker A Fun Way To Learn C

Report CopyRight/DMCA Form For : Web Cartoon Maker A Fun Way To Learn C


Copyright Information, This book is an Open Source Textbook OST Permission is granted to reproduce store or. transmit the text of this book by any means electrical mechanical or biological in accordance with. the terms of the GNU General Public License as published by the Free Software Foundation. This book is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY. without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR. PURPOSE See the GNU General Public License for more details. Web Cartoon Maker holds copyright for this book but this book is based on another book about. C How to think like a computer scientist by Allen B Downey released under the same GNU. General Public License, A lot of material for this book was contributed by our friend James E Schroeder Ph D EECS. UC Berkeley 1974 His help with this book and Web Cartoon Maker project is invaluable. Support Web Cartoon Maker, Web Cartoon Maker is free We do not ask you to pay for anything But there are several ways. you may help the project to live and be able to pay for server compiler and other software. 1 Are you planning to buy something on amazon com Do this using our link. http www amazon com tag webcarmak 20 and we ll receive a percentage of your total. purchase This will help us and will not cost you anything. 2 Can you draw or compose music You can donate your graphics and music to Web Cartoon. Maker project Just contact us at the link below,http www webcartoonmaker com index php contact us. 3 Write a good review for Web Cartoon Maker somewhere on the web. 4 Become our friend on YouTube and subscribe to our channel. http www youtube com subscription center add user webcartoonmaker. 5 Upload a cartoon to YouTube and make people know it was done in Web Cartoon Maker. Web Cartoon Maker a Fun Way to Learn C revision 2011 03 06 2. Table of Contents,Introduction 7,About Web Cartoon Maker 7.
What is a Programming Language 7,What is Debugging 10. Formal and Natural Languages 11,Our First Cartoon 13. WCM C Program Structure 13,Hello World as promised 14. Compiling 15,Variables Types and Operators 17,More Output 17. Variables Types and Operators 20,Variables 21,Assignment 22.
Outputting Variables 24,Operators 25,Order of Operations 27. Operators for Characters 27,Operators for Strings 28. Functions 29,Math Functions 29,String Functions 30. Server Time Functions 31,Cartoon Time Functions 31. Composition 33,Adding New Functions 33,Definition and Uses 34.
Programs with Multiple Functions 35, Web Cartoon Maker a Fun Way to Learn C revision 2011 03 06 3. Parameters and Arguments 35,Function Parameters and Variables are Local 36. Functions with Multiple Parameters 37,Functions with Results 37. Making Real Cartoons 38,Image Objects 38,Coordinates 40. Methods to Work with Image and Text Objects 45,Methods Unique to Text Objects 52.
Methods Unique to Image Objects 54,Summary 54,Character Objects 54. Summary 60,Playing Sounds 60,A Complete Cartoon 62. Size of an Animated Cartoon 68,Conditionals 72,Objects as Function Parameters 72. Conditional Execution 73,Alternative Execution 73,Chained Conditionals 74. Nested Conditionals 74,Working Example 75,Fruitful Functions 76.
Recursion 76,The Return Statement 78,Return Values 79. Composition 80,Overloading 81, Web Cartoon Maker a Fun Way to Learn C revision 2011 03 06 4. Boolean Values 82,Boolean Variables 82,Logical Boolean Operators 83. Converting Bools to Strings 83,Bool Functions 84,Leap of Faith 85. Iteration or Loops 85,Iteration 85,The While Statement 85.
Increment and decrement operators 86,For Loops 87,Break Statement 88. Continue Statement 89,Cartoonish Example 90,Classes and Objects 92. Introduction 92,The Point Class and Objects 93,Accessing instance variables 94. Operations on Objects 94,Call Pass by Value 97,Call Pass by Reference 98. Classes as Return Types 99,Constant Parameters 99,Passing Other Types by Reference 100.
Member Functions or Methods 100,Converting Functions to Methods 101. Constructors 102,Initialize or Construct 104,Protected Data 104. Inheritance 107, Web Cartoon Maker a Fun Way to Learn C revision 2011 03 06 5. Custom Characters 108,Introduction 108,Changing Walking Style 111. Customizing a Character s Decals 113,Changing a Decal 114.
Making a new character 116,Making Advanced Characters 120. Support Web Cartoon Maker 120,References 121, Web Cartoon Maker a Fun Way to Learn C revision 2011 03 06 6. Introduction,About Web Cartoon Maker, Web Cartoon Maker is a free online tool for development of animated 2D cartoons Unlike much. other similar software it does not pretend to be a so called WYSIWYG or What You See Is What. You Get tool It allows you to program your cartoons using a programming language While it may. sound odd at first it is more convenient and quick in many cases if you know how to write a. program Web Cartoon Maker uses a C programming language as its engine Pure C is not the. easiest language but Web Cartoon Maker s C also called WCM C has some extensions to. make the programming easier, There is a tutorial available at Web Cartoon Maker s web site at. http www webcartoonmaker com index php help which can help you to start programming simple. animated cartoons in no time but you must know some basic C syntax rules to write simple. WCM scripts A somewhat more complete understanding of C is needed to better understand the. examples and for more advanced programming such as creating characters Finally understanding. of C as implemented in WCM is a good first step towards understanding the language as a whole. If you haven t looked at the tutorial and some of the sample programs on the web site it is. suggested that you do so now This document is focused on some of the underlying features of. WCM and is not intended as a tutorial for the first time user Actually examining and running the. tutorial scripts as well as the code excerpts presented here will aid in understanding the underlying. concepts The best way to learn a programming language is to write programs. The material presented in this document ranges from vary basic material that must be understood. to effectively develop WCM animations to fairly advanced material that can safely be ignored by. those not wishing to understand the C language In many cases the level of the material is. indicated as follows,Very important for developing cartoons.
More advanced material for those who wish to learn C. Advanced cartoon making capabilities due to WCM being based on C. There are also notes scattered throughout the document These notes may help to clarify the. concepts involved or give some additional background concerning the development and peculiarities. of the syntax being described There are also some hints that cover various tricks to make your. cartoons more interesting While hopefully of interest to the reader such notes in general cover. material not necessarily needed for either developing cartoons or learning C. What is a Programming Language, The programming language you will be learning is C This is actually not a pure C but its. modification adopted by Web Cartoon Maker for development of animated cartoons C is a high. level programming language Other high level programming languages you might have heard of are. Java C C Basic and Fortran, Web Cartoon Maker a Fun Way to Learn C revision 2011 03 06 7. Note Most of these languages also have several versions or dialects Fortran was the first high. level scientific computer language and was developed in the late 1950 s over half a century ago It. still exists there is a Fortran 2008 but has generally been replaced by object oriented. languages such as C C and Java Object Oriented Programming OOP will be discussed later. in this document, Fun Note The most common first computer program shown for any computer language is a. Hello World program A WCM version of this classic program will be presented a few pages. later A collection of Hello World programs written in 441 different computer languages and 64. human languages is available at http www roesler ac de wolfram hello htm. Programs written in a high level language have to be compiled translated before they can run. Your programs scripts will be translated into a computer friendly low level language and run on. Web Cartoon Maker s server The result you will receive is an animated cartoon in WCM format. which can be played by WCM Player software and converted to other video formats to run on other. video viewers, Note that the WCM compiler differs from a general purpose compiler in that the. output is a video file instead of an executable computer file. In summary the C compiler interpreter installed on Web Cartoon Maker s server is going to. translate and run your programs It will compile your program to an intermediate format first and. then execute interpret it to produce animated cartoons In the process it will also use various. library elements such as characters sounds backgrounds etc A fairly extensive library is available. on the web and will be accessed automatically by the server You may also include other images. and sounds from the many sources available on the web For advanced users you may also create. your own characters images and sound tracks and store them on your own computer The WCM. will use the file paths provided and incorporate these into the final video. Web Cartoon Maker a Fun Way to Learn C revision 2011 03 06 8. What is a Program General C vs WCM C, A program is a sequence of instructions that specifies what should a computer do Unlike a.
general program flow however your WCM program will specify how to build your animated. cartoons rather than a general executable file There are a few basic functions that appear in about. every language as well as syntax rules that are language specific WCM follows the C rules and. in general supports the same programming functions that a regular C program does. A summary of the basic functions expected in C and the corresponding implementation or. lack of implementation in WCM are summarized below If you aren t interested in C as a. regular programming language you can either just skim this section or skip it altogether. 1 Input Get data from the keyboard or a file or some other device Since your programs. will be executed on Web Cartoon Maker s server there are no interactive input commands. supported Since the main purpose of Web Cartoon Maker is to produce non interactive. animated cartoons this limitations is not very important However if you are interested in. Web Cartoon Maker a Fun Way to Learn C revision 2011 03 06 9. C as a general programming language you should study the available input commands. 2 Output Display data on screen or send data to file or other device In our case we will. display our data in generated animated cartoons, 3 Math Perform basic mathematical operations like addition and multiplication While in. many cases we do not need them for programming animated cartoons these operations. still may be useful if we want a realistic animation of physics like ball trajectory or a. jumping pattern Random numbers are also sometimes useful. 4 String Manipulation Combine separate and otherwise manipulate groups of words and. characters Again this is often not needed but can be quite useful. 5 Testing Check for certain conditions and execute the appropriate sequence of statements. Like math and string manipulation this also is often not needed but can be quite useful. 6 Object Manipulation Many WCM C commands display move and otherwise change. the object characteristics that will be ultimately included in the final video output In. WCM C there is a built in library of objects and using these objects is the most. commonly used capability however in basic C there is no similar built in library. unless some graphics package such as GPL Graphics Programming Language is also. supported by the compiler, 7 Repetition Perform some action repeatedly usually with some variations This is a very. useful capability in WCM, Believe it or not that s pretty much all there is to it Every program you ve ever used no matter. how complicated is made up of functions that look more or less like these Thus one way to. describe programming is the process of breaking a large complex task up into smaller and smaller. subtasks until eventually the subtasks are simple enough to be performed with one of these simple. functions In our case of making non interactive animated cartoons it is even simpler because we do. not need input functions In later sections efficient and effective ways to accomplish these basic. tasks will be described in more detail,What is Debugging. Programming is a complex process and since it is done by human beings it often leads to errors. For whimsical reasons programming errors are called bugs and the process of tracking them down. and correcting them is called debugging, Fun Note The very early computers did not use transistors and integrated circuits but used.
vacuum tubes which operated at very high voltages or in some cases even electromechanical. relays It was not unusual for a real bug to get electrocuted inside the machine and affect operation. thus hardware bugs were a real problem, There are a few different kinds of errors that can occur in a program and it is useful to. distinguish between them in order to track them down more quickly. 1 Compile time errors The compiler can only translate a program if the program is. syntactically correct otherwise the compilation fails and you will not be able to run your. program Syntax refers to the structure of your program and the rules about that structure. For example in English a sentence must begin with a capital letter and end with a period. This sentence contains a syntax error So does this one For most readers a few syntax errors. are not a significant problem which is why we can read the poetry of E E Cummings. Web Cartoon Maker a Fun Way to Learn C revision 2011 03 06 10. without spewing error messages Compilers are not so forgiving If there is a single syntax. error anywhere in your program the compiler will print an error message and quit and you. will not be able to run your program To make matters worse there are more syntax rules in. C than there are in basic English and the error messages you get from the compiler are. often not very helpful During the first few weeks of your programming experience you will. probably spend a lot of time tracking down syntax errors As you gain experience though. you will make fewer errors and find them faster, 2 Run time errors The second type of error is a run time error so called because the error. does not appear until you run the program For the simple sorts of programs we will be. writing run time errors are rare so it might be a little while before you encounter one A. good example of run time error is a division by zero Because your programs will be. executed on Web Cartoon Maker s server they are little harder to debug and in case of a. runtime error you may receive a message like unknown error. 3 The third type of error is the logical or semantic error If there is a logical error in your. program it will compile and run successfully in the sense that the computer will not. generate any error messages but it will not do the right thing It will do something else In. our case events in animated cartoon may be different than we expected Specifically it will. do what you told it to do The problem is that the program you wrote is not the program you. wanted to write The meaning of the program its semantics is wrong Identifying logical. errors can be tricky since it requires you to work backwards by looking at the output of the. program and trying to figure out what it is doing In these cases it may be necessary to add. code to your program for the specific purpose of aiding in locating the logical error. One of the most important skills you should acquire from working with this book is debugging. Although it can be frustrating debugging is one of the most intellectually rich challenging and. interesting parts of programming In some ways debugging is like detective work You are. confronted with clues and you have to infer the processes and events that lead to the results you see. Debugging is also like an experimental science Once you have an idea what is going wrong you. modify your program and try again If your hypothesis was correct then you can predict the result of. the modification and you take a step closer to a working program If your hypothesis was wrong. you have to come up with a new one As Sherlock Holmes pointed out When you have eliminated. the impossible whatever remains however improbable must be the truth from A Conan Doyle s. The Sign of Four, For some people programming and debugging are the same thing That is programming is the. process of gradually debugging a program until it does what you want The idea is that you should. always start with a working program that does something and make small modifications debugging. them as you go so that you always have a working program In our case you can start with a very. simple animated cartoon and make small modifications to it one by one. Formal and Natural Languages, Natural languages are the languages that people speak like English Spanish and French They. were not designed by people although people try to impose some order on them they evolved. Formal languages are languages that are designed by people for specific applications For. example the notation that mathematicians use is a formal language that is particularly good at. denoting relationships among numbers and symbols Chemists use a formal language to represent. Web Cartoon Maker a Fun Way to Learn C revision 2011 03 06 11. the chemical structure of molecules And most importantly Programming languages are formal. languages that have been designed to express computations. As I mentioned before formal languages tend to have strict rules about syntax For example 3 3. 6 is a syntactically correct mathematical statement but 3 6 is not Also H2O is a syntactically. correct chemical name but 2Zz is not, Syntax rules come in two flavors pertaining to tokens and structure Tokens are the basic.
elements of the language like words and numbers and chemical elements One of the problems with. 3 6 is that is not a legal token in mathematics at least as far as I know Similarly 2Zz is not. legal because there is no element with the abbreviation Zz. The second type of syntax error pertains to the structure of a statement that is the way the tokens. are arranged The statement 3 6 is structurally illegal because you can t have a plus sign. immediately after an equals sign Similarly molecular formulas have to have subscripts after the. element name not before, When you read a sentence in English or a statement in a formal language you have to figure out. what the structure of the sentence is although in a natural language you do this unconsciously This. process is called parsing, For example when you hear the sentence The other shoe fell you understand that the other. shoe is the subject and fell is the verb Once you have parsed a sentence you can figure out what. it means that is the semantics of the sentence Assuming that you know what a shoe is and what it. means to fall you will understand the general implication of this sentence. Although formal and natural languages have many features in common tokens structure. syntax and semantics there are many differences, 1 Ambiguity Natural languages are full of ambiguity which people deal with by using. contextual clues and other information Formal languages are designed to be nearly or. completely unambiguous which means that any statement has exactly one meaning. regardless of context, 2 Redundancy In order to make up for ambiguity and reduce misunderstandings natural. languages employ lots of redundancy As a result they are often verbose Formal languages. are less redundant and more concise, 3 Literalness Natural languages are full of idiom and metaphor If I say The other shoe fell.
there is probably no shoe and nothing falling Formal languages mean exactly what they say. People who grow up speaking a natural language everyone often have a hard time adjusting to. formal languages In some ways the difference between formal and natural language is like the. difference between poetry and prose but more so, 1 Poetry Words are used for their sounds as well as for their meaning and the whole poem. together creates an effect or emotional response Ambiguity is not only common but often. deliberate, 2 Prose The literal meaning of words is more important and the structure contributes more. meaning Prose is more amenable to analysis than poetry but still often ambiguous. 3 Programs The meaning of a computer program is unambiguous and literal and can be. understood entirely by analysis of the tokens and structure. Here are some suggestions for reading programs and other formal languages First remember. that formal languages are much denser than natural languages so it takes longer to read them Also. the structure is very important so it is usually not a good idea to read from top to bottom left to. Web Cartoon Maker a Fun Way to Learn C revision 2011 03 06 12. right Instead learn to parse the program in your head identifying the tokens and interpreting the. structure Finally remember that the details matter Little things like spelling errors and bad. punctuation which you can get away with in natural languages can make a big difference in a. formal language, For writing complex programs it is often useful to first write a draft version of the program in a. natural language and use this version of the program called pseudo code to develop the basic. program flow The natural language program can then be rewritten in the formal computer. language with careful attention paid to correct syntax Examples of this approach will be given. later in this document,Our First Cartoon,WCM C Program Structure. You know that usually animated cartoons and other kinds of movies consist of scenes Animated. cartoons you are going to make with Web Cartoon Maker also consist of scenes The typical WCM. C program looks like this,void Scene1,void Scene2, Scene1 and Scene2 and there may be more of them like Scene3 Scene4 and so on are.
functions Please do not pay attention on the parentheses and word void yet their meaning will be. explained later, Note For those of you who don t want to wait for the full explanation at a very simple level. void and the parentheses just mean that Scene1 is complete in itself i e it doesn t need any input. from other parts of the program and does not supply any output from the function. These functions contain instructions or sentences inside a pair of squiggly. braces and specifying how to build a particular scene of your cartoon Some simple cartoons. may have only one scene and require only one Scene1 function The order of appearance of these. functions in your program does not matter For example Scene2 can be placed before Scene1 There. could also be any number of sentences inside these functions Almost all the sentences must end. with a semi colon, Please keep in mind that words sentence1 sentence2 and ellipsis symbols are not part of WCM. C but used for illustration only because we do not know any real sentences yet. Web Cartoon Maker a Fun Way to Learn C revision 2011 03 06 13. Note Also be aware that the exact definition of a function and the very similar method are. not standard between or sometimes even within the various high level languages Usually these. differences are not important but merely confusing but beware that occasionally the differences can. be significant While the usage is consistent within this document it may not be consistent with. other documents especially those addressing other high level languages. So what is a minimal program we can write using WCM C Can we just use one Scene1. function with no sentences in it Sure The program below can really be compiled using WCM C. and will produce a one second long black screen cartoon. void Scene1, But why one second long Actually the length of your animated cartoon is. calculated automatically depending on statements used We did not use any statements and the. length of our cartoon should be zero But zero length cartoons may cause troubles for some third. party software and WCM changes the cartoon length to one second when it is supposed to be zero. 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. Web Cartoon Maker a Fun Way to Learn C revision 2011 03 06 14. 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. 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, Let s compile our first cartoon We are going to use the Desktop Edition of Web Cartoon Maker. for this purpose,1 Start Web Cartoon Maker Desktop Edition.
2 Type the following program,void Scene1,declare a text object. Text MyText Hello World,make it visible,MyText SetVisible true. 3 Click Compile button on the toolbar, Web Cartoon Maker a Fun Way to Learn C revision 2011 03 06 15.

Related Books

Sample Individualized Action Plan For Mileage-Earning

Sample Individualized Action Plan For Mileage Earning

Sample Individualized Action Plan ... Sample Bank B For $95 a year, you would be able to earn 1.5 miles everywhere, Credit Card earn 2x-3x on bonus categories, & have airport lounge access. Bonus 50,000 miles after spending $3,000 in the first three months. Annual Fee $95 Points Earned Per Dollar Spent - 3x on dining & gas, - 2x on travel (Airfare, Hotels, Cruises, Car Rentals, Travel Agen

Overview - s3-eu-west-1.amazonaws.com

Overview s3 eu west 1 amazonaws com

The annual Author Insights Survey, run by Nature Publishing Group (NPG) and our sister company Palgrave Macmillan, forms part of a wider research programme which aims to understand general author attitudes and behaviours around publishing, and to track any changes over time.

Orientaciones para la elaboraci n y puesta en pr ctica de ...

Orientaciones para la elaboraci n y puesta en pr ctica de

No se trata de iniciar un proceso sistem tico y formal, sino de realizar una reflexi n general antes de iniciar el proceso de elaboraci n de una A.C.I. que, por el car cter y las repercusiones que va a tener en la escolarizaci n del alumno o alumna, debe ser la ltima medida que se adopte. Algunos de los aspectos que



gambar dalam upaya meningkatkan kemampuan membaca dan menulis. Pengumpulan data diperoleh dengan cara observasi, wawancara dan catatan lapangan. Hasil penelitian tindaka kelas menunjukkan bahwa implementasi tindakan kelas berupa penggunaan media gambar dapat meningkatkan kemampuan membaca dan menulis. Untuk mencapai tujuan penelitian tindakan






kemampuan membaca pemaha man siswa pada mata pelajaran Bahasa Indonesia. Hal itu disebabkan oleh kurangnya minat siswa dalam pembelajaran membaca dan penggunaan metode pembelajaran yang kurang beragam. Penelitian ini bertujuan untuk meningkatkan kemampuan membaca pemahaman siswa m ata pelajaran Bahasa Indonesia pada



ander dan het beoogde gebruik van het product. Ook eventuele pogingen tot reparatie of vervanging van een onderdeel of accessoire met andere onderdelen dan die van Hiplok, vallen niet onder de bepalingen van deze garantie. Deze garantie heeft prioriteit boven eventuele andere overeenkomsten of garanties, of ze nu

Encyclopedia of Psychology: 8 Volume Set

Encyclopedia of Psychology 8 Volume Set

Encyclopedia of Psychology: 8 Volume Set Alan E. Kazdin, PhD, Editor-in-Chief LIST PRICE: $750.00 ... David N. Aurelio James T. Austin Ceola Ross Baber

choices - Women's Health

choices Women s Health

your life and offers resources to help you make positive changes. Making healthy choices can improve the quality of your life in many ways, including how you physically look and feel and how you feel about yourself! It is all about YOU. At the end of the day, everything you do is about making choices.

Car Warranty Policy Document - Car Care Plan

Car Warranty Policy Document Car Care Plan

3 Thank you for choosing our Car Care Plan car warranty, which has been specially designed for CSMA Club members to make sure you get the most from your motoring with ...