New project, helpers needed

I’m making a game where there is an interactive ragdoll, Andy it hasn’t health, and you get weapons to attack him, once he dies, he revives in 6 seconds, problem is, I’m not a good coder

Please tell us more of what you already have…instead of asking us to make a game for you, try making some code yourself and then share it here for feedback.

@Pauls4eva Maybe you haven’t been on the forum long enough, but asking for helpers doesn’t seem to work out. I don’t know how many times I’ve seen a request for helpers, and I don’t think any of them ever worked. Everyone wants to write a game (except me), but they realize it takes a lot of work and experience that they don’t have. Anyone who would help actually wants someone to help them write a game. Who knows, maybe it will work out for you.

Hello, @Pauls4eva
I have started a ragdoll game a few months ago. It’s never been finished but I’m sure you can look at it and learn how to make a similar game.


--# Main
-- 2 Player Ragdoll Game

displayMode(FULLSCREEN)
supportedOrientations(LANDSCAPE_ANY)
-- Use this function to perform your initial setup
function setup()
    walls = physics.body(CHAIN, true, vec2(0,0), vec2(WIDTH,0), vec2(WIDTH,HEIGHT), vec2(0,HEIGHT))
    Players = {} -- 0.6 size
    Players.P1 = Ragdoll(WIDTH/4,HEIGHT/2,0.7,color(255,127.5,0))
    Players.P2 = Ragdoll(WIDTH/4*3,HEIGHT/2,0.7,color(0,127.5,255))
    Players.P1.JS = Joystick({x=125,y=125,size=150,colour=color(255,127.5,0,127.5)})
    Players.P2.JS = Joystick({x=WIDTH-125,y=125,size=150,colour=color(0,127.5,255,127.5)})
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(40, 40, 50)
    if touch1 then
        Players.P1.JS:touched(touch1)
        if touch1.state == ENDED then
            touch1 = nil
        end
    end
    if touch2 then
        Players.P2.JS:touched(touch2)
        if touch2.state == ENDED then
            touch2 = nil
        end
    end
    
    for _,p in pairs(Players) do
        if p.straights[1] then
        p.straights[1]:applyForce(p.JS.stickPos*1.5)
        end
        p:draw()
        p.JS:draw()
    end
end

function touched(t)
    local touch = {state=t.state,x=t.x,y=t.y,id=t.id}
    if touch1 then
        if touch1.id == t.id then
            touch1 = touch
        end
        elseif touch.state == BEGAN and t.x < WIDTH/2 then
        touch1 = touch
    end
    if touch2 then
        if touch2.id == t.id then
            touch2 = touch
        end
        elseif touch.state == BEGAN and t.x > WIDTH/2 then
        touch2 = touch
    end
end

Ragdoll = class()
function Ragdoll:init(x,y,s,colour)
    self.dead = false
    self.size = s
    self.colour = colour
    
    self.head = physics.body(CIRCLE,40*s)
    self.head.mass = s
    self.head.position = vec2(x,y+100*s)

    local body = physics.body(POLYGON,vec2(7,60)*s, vec2(7,-60)*s, vec2(-7,-60)*s, vec2(-7,60)*s)
    body.position = vec2(x,y)
    local neck = physics.joint(REVOLUTE, body, self.head, vec2(x,y+60*s))
    
    local leftUpperArm = self.createLimb(s)
    leftUpperArm.position = vec2(x - 37*s, y + 50*s)
    leftUpperArm.angle = 90
    local leftShoulder = physics.joint(REVOLUTE, body, leftUpperArm, vec2(x - 14*s, y + 50*s))
    
    local rightUpperArm = self.createLimb(s)
    rightUpperArm.position = vec2(x + 37*s, y + 50*s)
    rightUpperArm.angle = 90
    local rightShoulder = physics.joint(REVOLUTE, body, rightUpperArm, vec2(x + 14*s, y + 50*s))
    
    local leftLowerArm = self.createLimb(s)
    leftLowerArm.position = vec2(x - 97*s, y + 50*s)
    leftLowerArm.angle = 90
    local leftElbow = physics.joint(REVOLUTE, leftLowerArm, leftUpperArm, vec2(x - 67*s, y + 50*s))
    
    local rightLowerArm = self.createLimb(s)
    rightLowerArm.position = vec2(x + 97*s, y + 50*s)
    rightLowerArm.angle = 90
    local rightElbow = physics.joint(REVOLUTE, rightLowerArm, rightUpperArm, vec2(x + 67*s, y + 50*s))
    
    local leftUpperLeg = self.createLimb(s)
    leftUpperLeg.position = vec2(x - 7*s, y - 90*s)
    local leftLegJoint = physics.joint(REVOLUTE, body, leftUpperLeg, vec2(x - 7*s, y - 67*s))
    
    local rightUpperLeg = self.createLimb(s)
    rightUpperLeg.position = vec2(x + 7*s, y - 90*s)
    local rightLegJoint = physics.joint(REVOLUTE, body, rightUpperLeg, vec2(x + 7*s, y - 67*s))
    
    local leftLowerLeg = self.createLimb(s)
    leftLowerLeg.position = vec2(x - 7*s, y - 150*s)
    local leftKnee = physics.joint(REVOLUTE, leftLowerLeg, leftUpperLeg, vec2(x - 7*s, y - 120*s))
    
    local rightLowerLeg = self.createLimb(s)
    rightLowerLeg.position = vec2(x + 7*s, y - 150*s)
    local rightKnee = physics.joint(REVOLUTE, rightLowerLeg, rightUpperLeg, vec2(x + 7*s, y - 120*s))
    
    self.straights = {
    body,
    leftUpperArm,
    rightUpperArm,
    leftLowerArm,
    rightLowerArm,
    leftUpperLeg,
    rightUpperLeg,
    leftLowerLeg,
    rightLowerLeg
    }
    self.joints = {
    neck,
    leftShoulder,
    rightShoulder,
    leftElbow,
    rightElbow,
    leftLegJoint,
    rightLegJoint,
    leftKnee,
    rightKnee
    }
end

function Ragdoll:draw()
    pushMatrix()
    pushStyle()
    
    if self.head then
        if self.head.x < 0 or self.head.x > WIDTH or self.head.y < 0 or self.head.y > HEIGHT then
            self.head:destroy()
            self.head = nil
            self.dead = true
            else
            translate(self.head.x,self.head.y)
            
            fill(self.colour)
            noStroke()
            ellipse(0,0,80*self.size)
        end
    end
    
    strokeWidth(14*self.size)
    stroke(self.colour)
    lineCapMode(SQUARE)
    
    for i=#self.straights, 1, -1 do
        local b = self.straights[i]
        if b.x < 0 or b.x > WIDTH or b.y < 0 or b.y > HEIGHT then
            for _,j in pairs(self.straights[i].joints) do
                j:destroy()
                j = nil
            end
            b:destroy()
            table.remove(self.straights,i)
            else
            resetMatrix()
            
            translate(b.x,b.y)
            rotate(b.angle)
            
            local h = b.points[1].y
            line(0,-h,0,h)
        end
    end
    
    popMatrix()
    popStyle()
end

function Ragdoll.createLimb(size)
    return physics.body(POLYGON,vec2(7,30)*size, vec2(7,-30)*size, vec2(-7,-30)*size, vec2(-7,30)*size)
end


Joystick = class()
function Joystick:init(data)
    self.movingStick = false
    self.pos = vec2(data.x,data.y)
    self.stickPos = vec2(0,0)
    self.c = data.colour
    self.size = data.size or 100
    self.visible = true
    if data.initialValue then
        self.value = data.initialValue * 1
        else
        self.value = vec2(0,0)
    end
end

function Joystick:draw()
    if self.visible then
        pushStyle()
        pushMatrix()
        
        fill(0,0)
        stroke(self.c)
        strokeWidth(self.size/20)
        ellipseMode(CENTER)
        
        translate(self.pos.x,self.pos.y)
        ellipse(0,0,self.size)
        
        fill(self.c)
        noStroke()
        
        translate(self.stickPos.x,self.stickPos.y)
        ellipse(0,0,self.size/1.5)
        
        popStyle()
        popMatrix()
    end
end

function Joystick:touched(t)
    if self.visible then
        if t.state == ENDED then
            self.stickPos = vec2(0,0)
            else
            local tv = vec2(t.x,t.y)
            if tv:dist(self.pos) < self.size/2 then
                self.stickPos = tv - self.pos
                else
                self.stickPos = (tv - self.pos):normalize() * (self.size/2)
            end
            self.value = self.stickPos
        end
    end
end

The code contains a Ragdoll class and a Joystick class, too!