High Structural Integrity values on materials cause bullets to reflect off of them... this is the easiest, simplest, and overall best way to do it. This is also the way that the Reflective Bot works, at least in my version of the download.
But if you really wanted code to do it, it might look like this:
Code:
function Create(self)
self.mapwrapx = SceneMan.SceneWrapsX
end
function Update(self)
for bullet in MovableMan.MOPixels do
if bullet.Vel.Magnitude > 30 and SceneMan:ShortestDistance(self.Pos,bullet.Pos,self.mapwrapx).Magnitude < 30 then
if bullet.LastDist == nil then
bullet.LastDist = SceneMan:ShortestDistance(self.Pos,bullet.Pos,self.mapwrapx).Magnitude
end
if bullet.LastDist > SceneMan:ShortestDistance(self.Pos,bullet.Pos,self.mapwrapx).Magnitude then
bullet.Vel = bellet.Vel * -1
end
bullet.LastDist = SceneMan:ShortestDistance(self.Pos,bullet.Pos,self.mapwrapx).Magnitude
end
end
end
Though I doubt it's working code, hopefully you find it useful.
Just remember though, you don't need to use Lua for everything.