-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Wall API sample. Restore simple level sample.
- Loading branch information
Showing
6 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-- Set how large the level will be. | ||
pewpew.set_level_size(500fx, 500fx) | ||
|
||
-- Create an entity at position (0,0) that will hold the background mesh. | ||
local background = pewpew.new_customizable_entity(0fx, 0fx) | ||
pewpew.customizable_entity_set_mesh(background, "/dynamic/square500x500_graphic.lua", 0) | ||
|
||
-- Create the player's ship. | ||
local player_x = 250fx | ||
local player_y = 100fx | ||
local player_index = 0 -- there is only one player | ||
pewpew.new_player_ship(player_x, player_y, player_index) | ||
|
||
-- Create a "baf" enemy. | ||
local baf_x = 250fx | ||
local baf_y = 400fx | ||
local baf_angle = 0fx | ||
local baf_speed = 10fx | ||
local lifetime = -1 -- Use a negative number to indicate that the lifetime is infinite | ||
pewpew.new_baf(baf_x, baf_y, baf_angle, baf_speed, lifetime) | ||
|
||
local time = 0 | ||
|
||
-- A function that will get called every game tick, which is 30 times per seconds. | ||
function level_tick() | ||
-- Stop the game if the player is dead. | ||
local conf = pewpew.get_player_configuration(player_index) | ||
if conf["has_lost"] == true then | ||
pewpew.stop_game() | ||
end | ||
end | ||
|
||
-- Register the `level_tick` function to be called at every game tick. | ||
pewpew.add_update_callback(level_tick) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name":"Sample: Simple level", | ||
"descriptions":["Simple example that does next to nothing."], | ||
"entry_point":"level.lua" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
meshes = { | ||
{ | ||
vertexes = {{0,0}, {500,0}, {500,500}, {0,500}}, | ||
colors = {0xffffffff, 0xffff00ff, 0xff00ffff, 0x00ff0000}, | ||
segments = {{0,1,2,3,0}} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
meshes = { | ||
{ | ||
vertexes = {{0,0}, {500,0}, {500,500}, {0,500}, {100,200}, {400,200}, {200,100}, {400,300}}, | ||
colors = {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff0000ff, 0xff0000ff, 0xff0000ff, 0xff0000ff}, | ||
segments = {{0,1,2,3,0}, {4,5}, {6,7}} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
-- Set how large the level will be. | ||
pewpew.set_level_size(500fx, 500fx) | ||
|
||
-- Create an entity at position (0,0) that will hold the background mesh. | ||
local background = pewpew.new_customizable_entity(0fx, 0fx) | ||
pewpew.customizable_entity_set_mesh(background, "/dynamic/graphics.lua", 0) | ||
|
||
-- Create the walls. | ||
pewpew.add_wall(100fx, 200fx, 400fx, 200fx) | ||
pewpew.add_wall(200fx, 100fx, 400fx, 300fx) | ||
|
||
-- Create the player's ship. | ||
local player_x = 250fx | ||
local player_y = 250fx | ||
local player_index = 0 -- there is only one player | ||
pewpew.new_player_ship(player_x, player_y, player_index) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name":"Sample: Walls", | ||
"descriptions":["This level contains 2 extra walls."], | ||
"entry_point":"level.lua" | ||
} |