Skip to content

Commit

Permalink
New omnidirectional movement sample
Browse files Browse the repository at this point in the history
  • Loading branch information
andresan87 committed Oct 24, 2013
1 parent 47b4f23 commit 996470b
Show file tree
Hide file tree
Showing 34 changed files with 1,825 additions and 0 deletions.
10 changes: 10 additions & 0 deletions intermediate/omnidirectional-movement/app.enml
@@ -0,0 +1,10 @@
default
{
title = Ethanon Engine;
richLighting = true;

width = 480;
height = 480;
windowed = true;
vsync = true;
}
195 changes: 195 additions & 0 deletions intermediate/omnidirectional-movement/data/Verdana14_shadow.fnt

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
195 changes: 195 additions & 0 deletions intermediate/omnidirectional-movement/data/Verdana20.fnt

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
195 changes: 195 additions & 0 deletions intermediate/omnidirectional-movement/data/Verdana20_shadow.fnt

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
195 changes: 195 additions & 0 deletions intermediate/omnidirectional-movement/data/Verdana24.fnt

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
195 changes: 195 additions & 0 deletions intermediate/omnidirectional-movement/data/Verdana24_shadow.fnt

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
195 changes: 195 additions & 0 deletions intermediate/omnidirectional-movement/data/Verdana30.fnt

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
195 changes: 195 additions & 0 deletions intermediate/omnidirectional-movement/data/Verdana30_shadow.fnt

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
196 changes: 196 additions & 0 deletions intermediate/omnidirectional-movement/data/Verdana64.fnt

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
196 changes: 196 additions & 0 deletions intermediate/omnidirectional-movement/data/Verdana64_shadow.fnt

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions intermediate/omnidirectional-movement/effects/readme.txt
@@ -0,0 +1 @@
All *.PAR effect files must be in this folder.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions intermediate/omnidirectional-movement/main.angelscript
@@ -0,0 +1,55 @@
/*
This example takes the "shooting-spaceship" code and assign
the left and right keys to rotate the ship and up and down
keys do move it forward and backwards depending on current
direction.
*/

void main()
{
LoadScene("scenes/scene.esc");
}

// Receives a vector and an angle value in radians and returns the rotated vector
vector2 rotate(const vector2 &in p, const float angleRad)
{
return vector2(
p.x * cos(angleRad) + p.y * sin(angleRad),
- p.x * sin(angleRad) + p.y * cos(angleRad));
}

// Controls the ship
void ETHCallback_ship(ETHEntity@ thisEntity)
{
ETHInput@ input = GetInputHandle();

// computes the distance our ship must move in order to keep
// a speed of 60 pixels per second
float speed = UnitsPerSecond(120.0f);
float angleSpeed = UnitsPerSecond(160.0f);

vector2 direction(0.0f,-1.0f);

if (input.KeyDown(K_RIGHT))
{
thisEntity.AddToAngle(-angleSpeed);
}

if (input.KeyDown(K_LEFT))
{
thisEntity.AddToAngle(angleSpeed);
}

// compute rotation vector and do movement
direction = rotate(direction, degreeToRadian(thisEntity.GetAngle()));

if (input.KeyDown(K_UP))
{
thisEntity.AddToPositionXY(direction * speed);
}

if (input.KeyDown(K_DOWN))
{
thisEntity.AddToPositionXY(direction *-speed);
}
}
@@ -0,0 +1 @@
Ethanon Engine project file
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
1 change: 1 addition & 0 deletions intermediate/omnidirectional-movement/soundfx/readme.txt
@@ -0,0 +1 @@
All particle sound effect files must be in this folder.

0 comments on commit 996470b

Please sign in to comment.