 |
Forums |
Admin Start New Thread
By: Dave Lee
RE: got_hit event [ reply ] 2005-12-23 15:08
|
my prev example wouldn't work, maybe this tho:
class RobotRunner
alias_method :_hit, :hit
def hit(bullet)
result = _hit(bullet)
# replace energy value with bullet object
@events[-1] = bullet
result
end
end
|
By: Dave Lee
got_hit event [ reply ] 2005-12-22 21:34
|
is there a reason the robot doesn't get more information about bullet hits, like the direction from which it came?
this makes me wonder, are we allowed to redefine methods in RobotRunner? for example, I'm thinking:
class RobotRunner
def hit(bullet)
result = super
# replace energy value with bullet object
@events[-1] = bullet
return result
end
end
|
|
 |