aboutsummaryrefslogtreecommitdiff
path: root/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts')
-rw-r--r--build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/globals.lua19
-rw-r--r--build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/main_actor.lua100
-rw-r--r--build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/npc_jumper.lua20
-rw-r--r--build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/npc_walker.lua46
-rw-r--r--build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/shot-crawl.lua48
-rw-r--r--build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/shot-wave.lua34
-rw-r--r--build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/shot.lua33
7 files changed, 300 insertions, 0 deletions
diff --git a/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/globals.lua b/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/globals.lua
new file mode 100644
index 0000000..f5e2c7d
--- /dev/null
+++ b/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/globals.lua
@@ -0,0 +1,19 @@
+--the directions
+up=0
+right=1
+down=2
+left = 3
+
+--the alliances.
+enemy_neutral=0
+enemy_evil=1
+enemy_weapon=2
+enemy_superevil=3
+
+--sync configuration vars
+function this.sync(this)
+ this:set_physics(this.physics)
+ this:set_enemy(this.enemy)
+ this:set_controllable(this.controllable)
+ this:set_noclip(this.noclip)
+end \ No newline at end of file
diff --git a/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/main_actor.lua b/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/main_actor.lua
new file mode 100644
index 0000000..687a193
--- /dev/null
+++ b/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/main_actor.lua
@@ -0,0 +1,100 @@
+--Configuration for the Main Actor
+this.actorname = "Main Character"
+this.enemy = enemy_neutral
+this.controllable = true
+this.jumpstrength = 5.4
+this.speed = 3
+this.shotlimit = 3
+this.physics = true
+this.currentweapon = 0
+
+print(">>> Entity Created - "..this.actorname);
+
+function this.jump(this)
+ if not this:get_jumplock()
+ --and this:can_move(up,this:get_x()-this:get_ownspeed(),this:get_y()+this:get_vertical_speed())
+ and not this:can_move(down,this:get_x()-this:get_ownspeed(),this:get_y()) then
+ this:set_vertical_speed(this:get_vertical_speed()-this.jumpstrength)
+ end
+end
+
+function this.centermap(this)
+
+ this:set_map_sx(this:get_x() - this:get_cfg_screen_width()/2)
+ this:set_map_sy(this:get_y() - this:get_cfg_screen_height()/2)
+
+ if this:get_map_sx() < 0 then
+ this:set_map_sx(0)
+ elseif this:get_map_sx() + this:get_cfg_screen_width() >= this:get_cfg_max_map_w()*25 then
+ this:set_map_sx(this:get_cfg_max_map_w()*25 - this:get_cfg_screen_width())
+ end
+
+ if this:get_map_sy() < 0 then
+ this:set_map_sy(0)
+ elseif this:get_map_sy() + this:get_cfg_screen_height() >= this:get_cfg_max_map_h()*25 then
+ this:set_map_sy(this:get_cfg_max_map_h()*25 - this:get_cfg_screen_height())
+ end
+end
+
+function this.handleinput(this)
+ if (this:get_leftkey() > 0 and (this:get_leftkey() > this:get_rightkey() or this:get_rightkey() == 0)) then
+ this:set_ownspeed(-this.speed)
+ this:set_oldclip(1)
+ this:set_currentdirection(left)
+ end
+
+ if (this:get_rightkey() > 0 and (this:get_rightkey() > this:get_leftkey() or this:get_leftkey() == 0)) then
+ this:set_ownspeed(this.speed)
+ this:set_oldclip(2)
+ this:set_currentdirection(right)
+ end
+
+ if (this:get_rightkey() == 0 and this:get_leftkey() == 0) then
+ this:set_ownspeed(0)
+ end
+
+ if (this:get_xkey() > 0) then
+ if not this:get_jumplock() then
+ this:jump()
+ this:set_jumplock(true)
+ end
+ else
+ this:set_jumplock(false)
+ if(this:get_vertical_speed() < -1) then
+ this:set_vertical_speed(-1)
+ end
+ end
+
+ if (this:get_zkey() > 0) then
+ if not this:get_shootlock() and this:get_shotcount() < this.shotlimit then
+ if this.currentweapon == 0 then
+ this:add_bullet("./shotsprite.png","./scripts/shot.lua")
+ end
+ if this.currentweapon == 1 then
+ this:add_bullet("./shotsprite.png","./scripts/shot-crawl.lua")
+ end
+ if this.currentweapon == 2 then
+ this:add_bullet("./shotsprite.png","./scripts/shot-wave.lua")
+ end
+ this:set_shootlock(true)
+ end
+ else
+ this:set_shootlock(false)
+ end
+
+ if (this:get_ckey() > 0) then
+ if not this:get_switchlock() then
+ this.currentweapon = (this.currentweapon + 1) % 3
+ print ("current weapon is: "..this.currentweapon)
+ this:set_switchlock(true)
+ end
+ else
+ this:set_switchlock(false)
+ end
+end
+
+function this.act(this)
+ this:centermap()
+ this:handleinput()
+end
+--END \ No newline at end of file
diff --git a/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/npc_jumper.lua b/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/npc_jumper.lua
new file mode 100644
index 0000000..f58d1ff
--- /dev/null
+++ b/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/npc_jumper.lua
@@ -0,0 +1,20 @@
+--Configuration for the Jumper
+this.actorname = "Enemy: Jumper"
+this.enemy = enemy_evil
+this.controllable = false
+this.jumpstrength = 6
+this.physics = true
+
+print(">>> Entity Created - "..this.actorname);
+
+function this.jump(this)
+ if (this:get_vertical_speed() == 0 and math.random(150) == 50) then
+ this:set_vertical_speed(this:get_vertical_speed()-this.jumpstrength)
+ end
+end
+
+function this.act(this)
+ this:jump()
+end
+
+--END \ No newline at end of file
diff --git a/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/npc_walker.lua b/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/npc_walker.lua
new file mode 100644
index 0000000..1537464
--- /dev/null
+++ b/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/npc_walker.lua
@@ -0,0 +1,46 @@
+--Configuration for the Jumper
+this.actorname = "Enemy: Walker"
+this.enemy = enemy_evil
+this.controllable = false
+this.speed = 2
+this.physics = true
+
+print(">>> Entity Created - "..this.actorname);
+
+function this.walk(this)
+ if(this:get_currentdirection() == left) then
+ if ( this:can_move(left, this:get_x(), this:get_y()) and
+ not this:can_move(down, this:get_x()+this:get_ownspeed(), this:get_y())) then
+ if this:get_collision(left) then
+ this:set_currentdirection(right)
+ else
+ this:set_ownspeed(-this.speed)
+ end
+ this:set_oldclip(1)
+ else
+ this:set_currentdirection(right)
+ this:set_ownspeed(this.speed)
+ end
+ end
+
+ if(this:get_currentdirection() == right) then
+ if ( this:can_move(right, this:get_x(), this:get_y()) and
+ not this:can_move(down, this:get_x()+this:get_ownspeed(), this:get_y())) then
+ if this:get_collision(right) then
+ this:set_currentdirection(left)
+ else
+ this:set_ownspeed(this.speed)
+ end
+ this:set_oldclip(2)
+ else
+ this:set_currentdirection(left)
+ this:set_ownspeed(-this.speed)
+ end
+ end
+end
+
+function this.act(this)
+ this:walk()
+end
+
+--END \ No newline at end of file
diff --git a/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/shot-crawl.lua b/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/shot-crawl.lua
new file mode 100644
index 0000000..01b43dc
--- /dev/null
+++ b/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/shot-crawl.lua
@@ -0,0 +1,48 @@
+--parameters
+this.actorname = "Bullet: Crawlshot"
+this.enemy = enemy_weapon
+this.speed = 6
+this.controllable = false
+this.physics = true
+this.bumpcount = 0
+this.bumplimit = 4
+
+print(">>> Entity Created - "..this.actorname);
+
+function this.move(this)
+
+ if(this:get_currentdirection() == right) then
+ this:set_ownspeed(this.speed)
+ end
+
+ if (this:get_currentdirection() == left) then
+ this:set_ownspeed(-this.speed)
+ end
+
+ if ( ( not this:can_move(left, this:get_x(), this:get_y()) and this:get_currentdirection() == left ) or
+ ( not this:can_move(right, this:get_x(), this:get_y()) and this:get_currentdirection() == right ) ) then
+ this.bumpcount = this.bumpcount + 1
+
+ this:switchdirection()
+ if this.bumpcount >= this.bumplimit then
+ this:set_dying(true)
+ end
+ end
+end
+
+function this.switchdirection(this)
+
+ if(this:get_currentdirection() == right) then
+ this:set_currentdirection(left)
+ this:set_ownspeed(-this.speed)
+ elseif (this:get_currentdirection() == left) then
+ this:set_currentdirection(right)
+ this:set_ownspeed(this.speed)
+ end
+end
+
+function this.act(this)
+ this:move()
+end
+
+--END \ No newline at end of file
diff --git a/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/shot-wave.lua b/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/shot-wave.lua
new file mode 100644
index 0000000..758085b
--- /dev/null
+++ b/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/shot-wave.lua
@@ -0,0 +1,34 @@
+--parameters
+this.actorname = "Bullet: Wave"
+this.enemy = enemy_weapon
+this.speed = 10
+this.controllable = false
+this.physics = false
+this.angle = 0
+this.noclip = true
+
+print(">>> Entity Created - "..this.actorname);
+
+function this.move(this)
+
+ if(this:get_currentdirection() == right) then
+ this:set_ownspeed(this.speed)
+ end
+
+ if (this:get_currentdirection() == left) then
+ this:set_ownspeed(-this.speed)
+ end
+
+ this:set_y(this:get_y()+ (10 * math.sin(math.rad(this.angle))) )
+ this.angle = this.angle + 45
+
+ if ( this:get_x() < this:get_map_sx() or this:get_x() > this:get_map_sx() + this:get_cfg_screen_width()) then
+ this:set_dying(true)
+ end
+end
+
+function this.act(this)
+ this:move()
+end
+
+--END \ No newline at end of file
diff --git a/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/shot.lua b/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/shot.lua
new file mode 100644
index 0000000..3077f08
--- /dev/null
+++ b/build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/shot.lua
@@ -0,0 +1,33 @@
+--parameters
+this.actorname = "Bullet: Normal"
+this.enemy = enemy_weapon
+this.speed = 6
+this.controllable = false
+this.physics = false
+
+this:load_clip("./sfx/shot.wav");
+this:play_sfx("./sfx/shot.wav");
+
+print(">>> Entity Created - "..this.actorname);
+
+function this.move(this)
+
+ if(this:get_currentdirection() == right) then
+ this:set_ownspeed(this.speed)
+ end
+
+ if (this:get_currentdirection() == left) then
+ this:set_ownspeed(-this.speed)
+ end
+
+ if ( not this:can_move(left, this:get_x(), this:get_y()) or
+ not this:can_move(right, this:get_x(), this:get_y())) then
+ this:set_dying(true)
+ end
+end
+
+function this.act(this)
+ this:move()
+end
+
+--END \ No newline at end of file