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.
Need Support
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- master both
- Party member
- Posts: 262
- Joined: Tue Nov 08, 2011 12:39 am
- Location: Chile
Need Support
- Attachments
-
- test.love
- (436 Bytes) Downloaded 148 times
Re: Need Support
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.
I hope this helps!
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
- master both
- Party member
- Posts: 262
- Joined: Tue Nov 08, 2011 12:39 am
- Location: Chile
Re: Need Support
Thank you so much!
its works! how i didn thought about it
thanks
its works! how i didn thought about it
thanks
Re: Need Support
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
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
- master both
- Party member
- Posts: 262
- Joined: Tue Nov 08, 2011 12:39 am
- Location: Chile
Re: Need Support
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.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?
Re: Need Support
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
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
- master both
- Party member
- Posts: 262
- Joined: Tue Nov 08, 2011 12:39 am
- Location: Chile
Re: Need Support
I will try it, it seems that this is the best way to do it, thanks. I love this community, it always helpNixola 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...
EDIT: Errrr.... my computer doesnt support Canvas. I wonder how to make tron game in love2D.
Re: Need Support
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
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
- master both
- Party member
- Posts: 262
- Joined: Tue Nov 08, 2011 12:39 am
- Location: Chile
Re: Need Support
well... i have a netbook so dont expext a good one. Is an Intel(R) Graphics Media Accelerator 3150Nixola wrote:My pc didn't support canvases either, then I installed Ubuntu... Can you tell me what video card do you have?
Re: Need Support
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
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Who is online
Users browsing this forum: No registered users and 41 guests