diff options
Diffstat (limited to 'build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/shot-crawl.lua')
| -rw-r--r-- | build/Debug/Pico-Lua-Test.app/Contents/Resources/scripts/shot-crawl.lua | 48 |
1 files changed, 48 insertions, 0 deletions
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 |