Inicio do mapa
[Projeto-PCG.git] / weapon.cpp
blobcf1cdc7d14a382084f1e2d898f0b93b120d63923
1 #include "weapon.h"
2 #include "shot.h"
3 #include "shotmanager.h"
4 #include "game.h"
6 void Weapon::desenha() {
7 sprite.desenha();
10 void Weapon::fire(Ponto place, double angle, Shooter* _firedBy) {
11 firedBy = _firedBy;
12 lua_pushlightuserdata(lstate, (void *)this);
13 lua_gettable(lstate, LUA_REGISTRYINDEX);//obter funcao do script
14 //passar parametros
15 lua_pushnumber(lstate, place.x);
16 lua_pushnumber(lstate, place.y);
17 lua_pushnumber(lstate, angle);
18 lua_pushlightuserdata(lstate, this);
20 if (lua_pcall(lstate,4,0,0) != 0) /* do the call */
21 printf("error: %s", lua_tostring(lstate, -1));