Skip to content

The 'Spell Caster code' Construct example, but ported to TypeScript, to demonstrate using TypeScript in Construct.

Notifications You must be signed in to change notification settings

Scirra/Spell-Caster-TypeScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spell Caster TypeScript

This is the Spell Caster Code Construct example, which is originally written in JavaScript, but ported to TypeScript. It serves to demonstrate how TypeScript can be used for writing code in Construct.

This commit shows how to update JavaScript code to be compatible with TypeScript. It may be a useful reference for the kinds of changes that need to be made to update other existing JavaScript-based projects to TypeScript.

To learn more about using TypeScript in Construct, see the guide Using TypeScript in Construct.

Get the files

To get the files, click the green Code button and choose Download ZIP. Extract the ZIP contents to a folder on your system. Then use Construct's Open local project folder option and select the folder where the project files are.

Note

The Open local project folder is currently only supported in Chromium-based browsers, such as Google Chrome and Microsoft Edge. It is not currently supported in Safari or Firefox.

Set up TypeScript

Since Construct's TypeScript definition files change over time, they are not included in this repository. You can get Construct to create them by right-clicking on the Scripts folder in the Project Bar and selecting TypeScript - Update TypeScript definitions.

Edit the code

Next try opening the project folder in a TypeScript-compatible code editor such as VS Code.

Note

With VS Code, you need to install the TypeScript compiler separately. See TypeScript in Visual Studio Code for more details.

The code can be found in the scripts subfolder of the project. As you edit the code, you should find that VS Code is able to use type information to provide useful tools such as exact autocomplete suggestions, navigating and refactoring code, and identifying errors.

You can also use Construct's Auto reload all on preview mode to automatically load changes made from an external editor when previewing your project.

About

The 'Spell Caster code' Construct example, but ported to TypeScript, to demonstrate using TypeScript in Construct.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published