Hello Giderians
Have you experienced a thing I'm living on? I have a sprite that has the following:
function Ship:onMouseUp(event)
self:removeEventListener(Event.ENTER_FRAME, self.onShipFire, self)
end
function Ship:onMouseDown(event)
if self:hitTestPoint(event.x, event.y) then
self:addEventListener(Event.ENTER_FRAME, self.onShipFire, self)
end
end
function Ship:onShipFire()
local x, y = self:getPosition()
x = x + self:getWidth()/2
self.shot = Fire.new("objects/ship/fire_1.png", -30, 0, x, y)
self.shot:onFire()
end |
on the other sprite I have:
if self.ship.shot:collidesWith(self) then
self.damaged += 1
print(self.damaged)
end |
What i want: When I mouse down, is for the valuess to update, but it's not what's going on, the value just updates AFTER I MOUSE UP. I have no any idea why It happens I don't find any argument why It's happening.
Help me please.
Comments
http://g2d.atwebpages.com/reference.html?class=Sprite&method=TOUCHES_BEGIN
This really passed by me unoticed... Getting home I bring you news about.
Likes: oleg, Apollo14, antix
this "gear" sprite has a "sprite" as parameter
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
sorry i do not understand what you mean
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
doing more tests I figured out on collision detection function the values I change influences the distance of collision
I got a solution. I realized that... I don't know how I can explain the behaviour, mouse_down event I saw that the fire went to its destination and did what was expected it to do, but the fire would shoot once every time I 'mouse_down'. Then I created a
This way I configured the fire according to my needs
I suppose that as the frames quantity is too high, there must not have time for the fire to conclude, maybe only one shoot works, and as I was shooting one behind the other, the event leave to exist... I don't know too much technically, if someone could explain why It happens is very appreciated.