Requesting help

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Kakkassery_Joseph
Prole
Posts: 1
Joined: Fri Mar 15, 2024 1:14 pm

Requesting help

Post by Kakkassery_Joseph »

hey I'm having trouble with this syntax error can anyone explain why it is there (I'm new to love2d)

the error is Syntax error:slime.lua:36: '}' expected near '='

slime = {}
slime.jump_dist = 50
slime.jump_time = 1
slime.jump_height = 20
slime.hp = 3
slime.x = 100
slime.y = 100
slime.isjumping = false
slime.initiatejump = true
slime.fall_value = 10
slime.fall = 10

slime.sprite_var = 'slime_small.png'
slime.sprite = love.graphics.newImage(slime.sprite_var)
slime.width = slime.sprite:getWidth()
slime.height = slime.sprite:getHeight()
slime.original_height = slime.height
slime.original_width = slime.width
slime.squished_width_0_2 = slime.original_width / 0.2
slime.elongated_height = slime.original_height * 0.2
slime.originx = slime.width / 2
slime.originy = slime.height / 2

slime.shadowx = slime.x
slime.shadowy_offset = 50
slime.shadowy = slime.y + slime.shadowy_offset

function slime_jump()
if slime.isjumping == false then
slime.fall = slime.fall_value
local angle_radian = math.atan2(player.y - slime.y, player.x - slime.x)
local x_dist = slime.x + math.cos(angle_radian) * slime.jump_dist
local y_dist = slime.y + math.sin(angle_radian) * slime.jump_dist
local current_jump_height = slime.jump_height - y_dist
-- Tweening slime.y to make the slime jump
flux.to(slime, slime.jump_time/2, {slime.y = current_jump_height}):ease("expoout"):after(slime, slime.jump_time/2, {slime.y = y_dist}):ease("expoin")
flux.to(slime, slime.jump_time, {slime.x = x_dist}):ease("linear"):oncomplete(set_isjumping_to_false)
-- Tweening slime.width and slime.height to add squishing animation
flux.to(slime, slime.jump_time/2, {slime.width = slime.squished_width_0_2, slime.height = slime.elongated_height}):ease("expoout"):after(slime, slime.jump_time/2, {slime.width = slime.original_width, slime.height = slime.original_height}):ease("elasticin")
end
end

function set_isjumping_to_false()
slime.isjumping = false
end
User avatar
togFox
Party member
Posts: 779
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Requesting help

Post by togFox »

If you wrap the above in code tags and then paste row 36 here then we can see if we can get you sorted.
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 43 guests