Collisions

thank you. You’re the best :slight_smile:

Is it possible to be touching on both sides and still work so I can use the other half of the screen?

@compactbear I changed the above code to use the full screen for touch.

Sorry I wasn’t clear. I would like to use the other side for shooting and not moving but if I move my finger from the left side to right the player infinately moves. sorry my bad

if t.x < WIDTH / 2 then
            if t.state == BEGAN then
                x = t.x
                y = t.y
                tx = x
                ty = y
                move = true
            elseif t.state == MOVING then
                tx = t.x
                ty = t.y
                move = true
            elseif t.state == ENDED then
                x,y = 0, 0
                tx, ty = 0,0
                move = false
            end
        elseif t.x > WIDTH / 2 then
            x,y = 0,0
            tx,ty = 0,0
            local currentx = t.x
            local currenty = t.y
            local id = t.id
            if t.state == BEGAN then
                swipex = currentx
                swipey = currenty
                swipeid = id
            elseif t.state == ENDED and id == swipeid then
                swipeid = nil
                dx = 0
                dy = 0
                if swipey - currenty > 75 then     
                    print 'down'
                    dy = -1
                elseif currenty- swipey > 75 then
                    print "up"
                    dy = 1
                elseif swipex - currentx > 75 then
                    print "left"
                    dx = -1
                elseif currentx - swipex > 75 then
                    print "right"
                    dx = 1
                end
                if dx ~= 0 or dy ~= 0 then
                    table.insert(bullets, vec4(sx, sy, dx, dy))
                    
                end
            end

@compactbear I changed the code above to stop at half the screen. As for shooting, where are the bullets coming from.

the sprite, This is just a filler and I am still working with it

For now its the sprites x y