Creating a C++ Script | Unreal Tutorial

Scripts are so important when it comes to making a game in Unreal. For an in-depth lesson on Unreal, consider enrolling in Mammoth Interactive’s Unreal course

If you want to add a player to your game, you need to write code to give the player its own behavior. Default modes contain logic from Unreal. To create a new mode with custom behavior, you need to write a script.

Go to C++ Classes > CoinCollector in the Content Browser. Right-click in the Content Browser. Select “New C++ Class”.

Select “Pawn” from the “Choose Parent Class” to extend a pawn. With the Pawn class, the mode to be able to receive input from the player. The player will be able to move the mode.

Press Next. Name the pawn “HeroController”. Our player to be a hero who collects coins. Press “Create Class”. Unreal will create the script. Note that it does take some time for Unreal to create or compile a script.

We will enable HeroController to move based on user input. When the code compiles, you can open Xcode to view the files of the script if you are on a Mac. If you do not own Xcode, you can download it from the App Store. Xcode is a free program that you can use to write code.

If you are using Windows, you can use Visual Studio to write your code. Visual Studio should already be on your computer.

The Files of a C++ Script

Two files will open with the script: HeroController.h and HeroController.cpp. These are two different files for a single class. .h files are header files. They are used to list variables and methods in a class.

.cpp files are implementation files. They are used to implement those methods and variables. HeroController.cpp contains the implementation of HeroController’s behavior.

We will begin coding in HeroController.h. Some default code is already in the file. class COINCOLLECTOR_API AHeroController : public creates the class. Then there are five public functions:

  • The ACoinController function is a constructor. ACoinController is called when the script loads (when the object is created).
  • BeginPlay is a function that is called when the game starts (after the constructor and internal processes complete). A function performs a method or operation. You can use functions to set the behavior of an object.
  • Tick is a function that is called every frame (every time the game is processed by your computer, smartphone, or console).
  • SetupPlayerInputComponent is a function that is called to configure the input. Whenever we want to make HeroController move left, right, top, or bottom, we need to register the input bindings in this function.

Note that typing // in front of a line turns the code into a comment, which is not read by the compiler. You can use comments to organize code.

To learn how to build 6 games in Unreal, enroll in our Unreal course.

Learn JavaScript in 1 Hour! Book Release

All you need is 1 Hour.

Do you want to learn the foundations of computer programming? Are you tired of being bogged down by confusing jargon and complex descriptions? We have the book for you: Learn JavaScript in 1 Hour.

Learn JavaScript in 1 Hour is an easy-to-understand introduction to JavaScript. With this book, your website will be up-and-running in no time!

Important topics in web development are shown with examples that are easy to read. If you have a Mac computer, PC, or even a mobile device, you can follow along with the book’s examples on www.jsbin.com. JSBin is an editor that allows you to see your creations in real time.

Learn JavaScript in 1 Hour covers topics including:

Functions – Finally your website can do things! It’s not just a pretty face. Learn how to enable your site to perform tasks.

Variables – Integers, doubles, floats, characters, strings: these are all different types of variables. Variables are crucial to programming because they contain data. Learn about the different types and when you should use each one.

If Statements – If you read Learn JavaScript in 1 Hour, you will reach the section on conditionals. If statements run code IF a specific condition is met. With an if statement, you can test a value, run certain code only when you want to, and prevent your site from crashing!

If you want to learn how to give a website functionality, Learn JavaScript in 1 Hour can teach you the foundations of using JavaScript. Even if you have never coded before, you can follow along. For more books on tech topics, visit our Lulu shop.

The Ultimate iOS 10, Xcode 8 Development Book. Build 30 Apps!

Over 700 pages. This is the largest iOS and Swift book ever released.

Have you always wanted to create your own iOS app? Mammoth Interactive has written a new book just for you: The Ultimate iOS 10, Xcode 8 Developer Book.

Even if you have never coded before, you can learn how to build an app from scratch using Xcode. The Ultimate iOS 10, Xcode 8 Developer Book takes you step-by-step through designing, coding, and testing different iOS applications.

The code in The Ultimate iOS 10, Xcode 8 Developer Book is easy to follow along with. The book’s numerous screenshots ensure that no learner is left behind.

The Ultimate iOS 10, Xcode 8 Developer Book contains three parts:

Playground – In Part 1, you learn the foundations of Xcode using Swift 3.0’s Playground. The Playground is the perfect place to test code in real-time. We use the Playground to introduce important Xcode topics, including: variables, statements, functions and loops.

UI Elements – Apps are made up of User Interface (UI) elements. In Part 2, you create Projects to test common UI elements, including labels, buttons, and text fields. With code, you learn to implement the objects to give them functionality.

Example Apps – In Part 3, we create several functioning apps. To build an app, we design its layout and implement its functionality. You learn how to test your apps by running them in the Simulator.

If you are a beginner, The Ultimate iOS 10, Xcode 8 Developer Book is the perfect book to learn the foundations of developing for iOS. We use practical examples that you will be able to reference when building your own apps. Your first app will be up-and-running in no time!

Learn CSS in 1 Hour! Book Release

1 Hour is all it takes.

Do you want to make a stunning website? Mammoth Interactive has released a book to teach you how to put that design into reality: Learn CSS in 1 Hour.

With CSS, you can design a site to look exactly how you want it. You can manipulate many aspects, from the size of text to the color scheme.

Important topics in web development are shown with examples that are easy to read. If you have a Mac computer, PC, or even a mobile device, you can follow along with the book’s examples on www.jsbin.com. JSBin is an editor that allows you to see your creations in real time.

Learn CSS in 1 Hour covers topics including:

The History of Fonts – Did you know that there are numerous types of fonts that each serve a different purpose? We dig deep into serif, sans-serif, monospace, and more! You will learn how to customize a font to meet the specific needs of every site you create.

Padding and Margins – A website is clean and minimalist when items are spaced out on the page. Learn how to separate sections of your site to make it look visually appealing.

Adding a Menu – Can’t have your website users getting lost! Learn CSS in 1 Hour teaches you how to create a menu so that users can navigate throughout the pages of your site.

If you want an introduction to web design that is easy to follow along with, this book is for you. Even if you have never coded before, you can follow along. For more books on tech topics, visit our Lulu shop.

Book Released! Learn HTML in 1 Hour

Do you have a great website idea that you want to make come to life? Meet Mammoth Interactive’s book: Learn HTML in 1 Hour.

Whether you want to learn the basics of coding or build your own website from scratch, Learn HTML in 1 Hour can teach you the foundations of coding – in only one hour. Coding is not something to be afraid of.

HTML is the foundation of the web. If you are a beginner and want to learn how to code, Learn HTML in 1 Hour is meant and built especially for you.

Important topics in web development are shown with examples that are easy to read. If you have a Mac computer, PC, or even a mobile device, you can follow along with the book’s examples on www.jsbin.com. JSBin is an editor that allows you to see your creations in real time.

If you want to brush up on the skills you learned in a tech class years ago, or even if you’ve never coded a line before, this book is for you. You will learn topics including:

Font Style – You will learn how to style the contents of your webpage so that you’re not always using the default fonts and colors – boring! Italicize, bold, and underline! You never know when the text on your site could need it.

Images and Links – Make your site visual and dynamic by adding image files that link to different areas of the web.

Lists – It is easier to read things when they are in a list (like this one). Master ordered and unordered lists to make paragraphs easier to read.

Input Tags – Communicate with your users! Create input tags and submit buttons so that site visitors can send you messages.

Learn HTML in 1 Hour provides a clear, concise introduction to web design that anyone from your great-grandmother to your little brother can follow. You can code! For more books on tech topics, visit our Lulu shop.