Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Collision is never detected if the character jumps and works otherwise — Gideros Forum

Collision is never detected if the character jumps and works otherwise

simransimran Member
edited June 2014 in General questions
I have this piece of code, I am using it to detect collisions, It does detects collisions but only if the character never jumps and continue to trace through the same elliptical path, If I jump the character even once, The collision is never detected in the the game ever. Where am I doing it wrong?


if playertouch then
speed = 10
angle2 = 30
speedx = math.cos(20)
speedy = math.sin(130)
velocityx = speed*speedx
velocityy = speed*speedy
point = tntCollision.pointToObox
for i = 1, 1 do
x = x + velocityx
y = y + velocityy
self: setScaleY(1.8)
if point (x, y, sechand:getX(), sechand:getY(),206, 64, sechand:getRotation()) then
tntCollision.setCollisionAnchorPoint(0.2257, 0.5)
end
end

elseif playertouch == false then
for i = 1,1 do
x = x - velocityx
y = y - velocityy
x = 215 + math.cos(angle)*195
y = 130 + math.sin(angle)*115
self:setScaleY(1)
if point (x, y, sechand:getX(), sechand:getY(),206, 64, sechand:getRotation()) then
tntCollision.setCollisionAnchorPoint(0.2257, 0.5)
end
end
else
x = 215 + math.cos(angle)*195
y = 130 + math.sin(angle)*115
if point (x, y, sechand:getX(), sechand:getY(),206, 64, sechand:getRotation()) then
tntCollision.setCollisionAnchorPoint(0.2257, 0.5)
print('end of game')
end
end
self:setPosition(x,y)

Comments

Sign In or Register to comment.