Create a new Lua file called code.lua
in your Workspace/Sandbox/
folder.
Create a new local
variable called fireballSprites
inside the script
:
local startValue = 0 | |
local handValue = {} | |
local timeDelay = 1 | |
local timeCount = 0 | |
local cursorPos = 0 | |
local gameOver = true | |
local BLACK, WHITE, GREY = 32, 51, 27 | |
function PadNumber(value, length) | |
return string.format("%0"..length.."d", value) |
Mono: Config attempting to parse: './mono/config'. | |
Mono: Config attempting to parse: '/home/parallels/.mono/config'. | |
Mono: process_set_name: using [Pixel Vision 8 Runner.exe] as prog name | |
Mono: mono_w32handle_new: create Process handle 0x1f82d50 | |
Mono: Assembly Loader probing location: '/home/parallels/Desktop/Pixel Vision 8 Runner-Linux/mscorlib.dll'. | |
Mono: Image addref mscorlib[0x1f948e0] -> /home/parallels/Desktop/Pixel Vision 8 Runner-Linux/mscorlib.dll[0x1f93350]: 2 | |
Mono: Prepared to set up assembly 'mscorlib' (/home/parallels/Desktop/Pixel Vision 8 Runner-Linux/mscorlib.dll) | |
Mono: Assembly Loader loaded assembly from location: '/home/parallels/Desktop/Pixel Vision 8 Runner-Linux/mscorlib.dll'. | |
Mono: Config attempting to parse: '/home/parallels/Desktop/Pixel Vision 8 Runner-Linux/mscorlib.dll.config'. | |
Mono: Config attempting to parse: './mono/assemblies/mscorlib/mscorlib.config'. |
Microsoft (R) Build Engine version 15.6.0.0 (xplat-master/ca830585 Sun Mar 25 19:24:09 EDT 2018) for Mono | |
Copyright (C) Microsoft Corporation. All rights reserved. | |
/Library/Frameworks/Mono.framework/Versions/5.10.1/lib/mono/msbuild/15.0/bin/MSBuild.dll /p:Configuration=Release /t:Build /v:diag ./Desktop.csproj | |
Build started 7/23/2018 11:13:00 AM. | |
Environment at start of build: | |
LANG = en_US.UTF-8 | |
TERM = xterm-256color | |
TERM_PROGRAM = Apple_Terminal | |
SHLVL = 1 |
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props')" /> | |
<PropertyGroup> | |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |
<ProductVersion>8.0.30703</ProductVersion> | |
<SchemaVersion>2.0</SchemaVersion> | |
<ProjectGuid>{A931DB73-1032-4087-8371-FB3744ADFA0D}</ProjectGuid> | |
<OutputType>WinExe</OutputType> |
Microsoft (R) Build Engine version 15.7.177.53362 for .NET Framework | |
Copyright (C) Microsoft Corporation. All rights reserved. | |
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\bin\msbuild.exe /p:Configuration=Release /p:PackageTargetPlatforms=Itchio /t:BuildGamePackages /v:diag C:\Users\jessefreeman\Documents\PublishTest\PublishTest.csproj | |
Build started 7/16/2018 8:54:41 AM. | |
Environment at start of build: | |
ALLUSERSPROFILE = C:\ProgramData | |
APPDATA = C:\Users\jessefreeman\AppData\Roaming | |
CommandPromptType = Native | |
CommonProgramFiles = C:\Program Files (x86)\Common Files |
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props')" /> | |
<PropertyGroup> | |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |
<ProductVersion>8.0.30703</ProductVersion> | |
<SchemaVersion>2.0</SchemaVersion> | |
<ProjectGuid>{A931DB73-1032-4087-8371-FB3744ADFA0D}</ProjectGuid> | |
<OutputType>WinExe</OutputType> |
-- The first thing we are going to do is create a table to store the two fireball sprites. | |
local fireballSprites = {0, 1} | |
-- You can always preview the sprites.png file by using the Game Creator Pro's Sprite Editor. Here you can see that our first two sprites are the fireballs and the rest of the sprites come from the default.font.png file. | |
-- ![Draw Sprite Tutorial](http://tutorials.pixelvision8.com/wp-content/uploads/2018/06/draw-sprite-editor.png) | |
-- Next, we are going to create an object that represents the final fireball we plan on animating later on in the tutorial. This table store the sprite ID to draw to the display and the horizontal and vertical flip values which are flipH and flipV. | |
local fireball = { | |
spriteID = fireballSprites[1], |
local score = 0 | |
local scoreDisplay = -1 | |
local pos = NewVector(101, 123) | |
function DrawScore() | |
-- Update score | |
if(scoreDisplay ~= score) then | |
local diff = math.floor((score - scoreDisplay) / 4) | |
if(diff < 1) then |