Need Support

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.
User avatar
master both
Party member
Posts: 262
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Need Support

Post by master both »

Hi, im new in coding and im trying to make a dot that moves throught while leaving a track.
The method im trying to do this is by adding the positions of the dot while it moves to a table, and then draw point in them.
I dont know if there are better methods to do this because the problem is that the dot move slower every second and my deltatime keeps getting bigger... So is there a way to make the tray better?

The controls to move the dot is "w" and "s".

sorry for any bad english. :)
Attachments
test.love
(436 Bytes) Downloaded 148 times
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Re: Need Support

Post by Santos »

To move the dot at a constant speed, multiply the changes to boxx and boxy by dt. Also, multiply them by another variable to control the speed.

Code: Select all

function love.load()
	-- Other things

	speed = 100
	turningSpeed = 5
end


function love.update(dt)
	-- Other things

	move(dt) -- Note the "dt" argument!

	if love.keyboard.isDown("s") then
		direction = direction - turningSpeed * dt
	end
	if love.keyboard.isDown("w") then
		direction = direction + turningSpeed * dt
	end
end

function move(dt) -- Note the "dt" parameter!
	boxx = boxx + math.cos(direction) * dt * speed
	boxy = boxy + math.sin(direction) * dt * speed
end
I hope this helps! ^^
User avatar
master both
Party member
Posts: 262
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: Need Support

Post by master both »

Thank you so much!
its works! how i didn thought about it
thanks
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Need Support

Post by Nixola »

This way the point keeps moving at a constant speed, but the framerate doesn't... Do you need to know where did the point pass?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
master both
Party member
Posts: 262
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: Need Support

Post by master both »

Nixola wrote:This way the point keeps moving at a constant speed, but the framerate doesn't... Do you need to know where did the point pass?
that would be great, im trying to make like a tron game so i still have to do the collison stuff. im new in programing so a little help cant do bad. :)
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Need Support

Post by Nixola »

Well, the fastest (and simplest, I think) way to do this would be using Canvases, I think, but there are some (many) PCs that don't support them...
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
master both
Party member
Posts: 262
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: Need Support

Post by master both »

Nixola wrote:Well, the fastest (and simplest, I think) way to do this would be using Canvases, I think, but there are some (many) PCs that don't support them...
I will try it, it seems that this is the best way to do it, thanks. I love this community, it always help :)

EDIT: Errrr.... my computer doesnt support Canvas. I wonder how to make tron game in love2D.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Need Support

Post by Nixola »

My pc didn't support canvases either, then I installed Ubuntu... Can you tell me what video card do you have?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
master both
Party member
Posts: 262
Joined: Tue Nov 08, 2011 12:39 am
Location: Chile

Re: Need Support

Post by master both »

Nixola wrote:My pc didn't support canvases either, then I installed Ubuntu... Can you tell me what video card do you have?
well... i have a netbook so dont expext a good one. Is an Intel(R) Graphics Media Accelerator 3150
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Need Support

Post by Nixola »

I've got a netbook with an Intel card too, and on Ubuntu I support both npot and canvases
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Post Reply

Who is online

Users browsing this forum: No registered users and 41 guests