Space Dodge [Lense Overview]
Here is a quick breakdown on the proccess of creating 'Space Dodge' my most recent game created in Lens Studio, almost entirely created with JavaScript.
USE THE LENS HERE
From concept, to product this lens totalled nearly 12 hours of constant development.
Day 1: Creating the Object Spawning system, I started with a simple line of 3D rocks, spaced 5 units apart from eachother along the X axis.
With my Rocks in place, I created a new Script and gave each rock (15) a name inside an Array
var Rocks = [
"targetObject1",
"targetObject2"
];
A new variable is created, so our script can randomly select Rocks from the list I provided:
var Spawn = Rocks[Math.floor(Math.random()*Rocks.length)];
With these created, I made use of them inside an onTapped event, starting the game by Enabling random rocks, every 2 seconds:
function onTapped(eventData)
var delayedEvent = script.createEvent("DelayedCallbackEvent");
delayedEvent.bind(function(eventData)
{
if (Spawn == "targetObject1"){
onTapped(); // Re-runs the tapped Function
deSpawn(); // Runs our Despawn script
script.targetObject1.enabled = true;
} else if (Spawn == "targetObject2") {
onTapped();
deSpawn();
script.targetObject2.enabled = true;
});
delayedEvent.reset(2);
}
Once the rocks have spawned, we disable random rocks every 5 seconds.
function deSpawn() {
var deSpawn = Active[Math.floor(Math.random()*Rocks.length)];
var deSpawnEvent = script.createEvent("DelayedCallbackEvent");
deSpawnEvent.bind(function(eventData)
print(Active);
if (deSpawn == "targetObject1"){
script.targetObject1.enabled = false;
} else if (deSpawn == "targetObject2") {
script.targetObject2.enabled = false;
});
deSpawnEvent.reset(5);
}
These funtions will continue forever, or until the user hits a rock.
I then simply used the Collision System asset for the rocket to enable a Game Over screen if the rocket hits a rock.
Great
Thanks , ethanprimmer
Cool keep growing