/template-camera-and-input

Template project showing how to set up a camera and handle mouse input

Primary LanguageLua

Camera and Input template

This project template can be used as a starting point for top down strategy games or point and click games where you need both a camera and mouse input on game objects. The template uses the following libraries:

  • Defold-Orthographic - 2D camera solution
  • Defold-input - Input utilities, and in this case specifically the cursor module to handle drag, click over/out etc

Usage

You can use theis template project in two ways:

  1. Download the project as a zip file, unpack it and open in Defold
  2. Click on the green "Use this template" button to make a copy of the project on your own GitHub account

Demo

Test an HTML5 version here: https://britzl.github.io/CameraInput/

Click and drag on the map to move it. Mouse wheel to zoom.

Click and drag on tanks to move them. Infantry can't be dragged.