I don’t mind taking a look, I’m just trying to help you.
The only possible way of making it smooth is through this calculation.
v = s * dt
I don’t mind taking a look, I’m just trying to help you.
The only possible way of making it smooth is through this calculation.
v = s * dt
After using that exactly. 1:1 it simply doesn’t work then. Everything just stops. This is my code btw:
local Drag = Vector2.new(Velocity.X*2*Steering,(HasEffect("Weight") and -9.8 or -4.9)*Weight)*dt*Speed
local x = math.clamp(Velocity.X,-25,25)
local y = altitude == 0 and not Up and 0 or math.clamp(Velocity.Y,-20*MSpeed,20*Weight)
Velocity = (Vector2.new(x,y))-Drag
local ScaleVelocity = Velocity/Screen.AbsoluteSize
local FullPos = Vector2.new(Balloon.Position.X.Scale,Balloon.Position.Y.Scale) + ScaleVelocity
altitude = math.clamp(altitude-(Velocity.Y*dt),0,math.huge)
Balloon.Position = UDim2.fromScale(math.clamp(FullPos.X,ScaleSize.X/2,1-ScaleSize.X/2),math.clamp(FullPos.Y,0.4,0.8))
Balloon.Rotation = Velocity.X
As soon as I apply dt to Velocity it just breaks.
Maybe…
Perhaps the drag is greater than the Velocity, in which case it has to be applied to velocity as well. I would honestly encourage you to recode this a little bit so there’s more clarity. Drag should be calculated based on the current velocity and not the previous as well.
Try something like this, I haven’t tested it but you can figure your way around it
local speed = 5
local steering = 1
local function HasEffect(effect : string)
return true
end
RunService.Heartbeat:Connect(function(dt)
local verticalVelocity = speed * dt
local horizontalVelocity = steering * dt
local drag = HasEffect("Weight") and 5 or 1
verticalVelocity = verticalVelocity - drag * dt
horizontalVelocity = horizontalVelocity - drag * dt
end)
That code is far more understandable than @NoxhazeI’s code. You forgot the part where it sets the position and rotation btw.
I am not the best when it comes to cleaning code. My code is practical but ugly.
Isn’t that just what I am doing? Also can’t you do:
RunService.RenderStepped:Connect(function(dt)
local verticalVelocity = speed
local horizontalVelocity = steering
local drag = HasEffect("Weight") and 5 or 1
verticalVelocity = (verticalVelocity - drag) * dt
horizontalVelocity = (horizontalVelocity - drag) * dt
end)
You got your first like from MEEEEE Nicely done game! Fun!
Very interesting!
Reminds me a lot of those mobile games from the 2015 that have too many ads nowadays
I used to love them while the ads were kept minimal, anyway hope I didn’t move too far from topic
I see a lot of potential in that, you could do a little tweaks, a little progression difficulty and it could have quite a bit of replay-ability especially for those people trying to get on the leaderboards!
Hmm, indeed it can have more stuff to it but I gave some reasons why I can’t in the original topic.
I will not let that slide
where u at? 30 million chars or so more typing
I am always 100m away from you
I noticed the game starts lagging at around 1.5km
yo can do it!! hold the space bar down!! do it!
At 1.5km? Odd, when I tested it there was no lag. Maybe ill add an ability to remove all particles if that’s okay?
This game looks VERY good so far! Nice idea, it’s pretty unique for Roblox! Nice job on this!
Yep, thanks for the feedback. I always liked this idea for its simplistic design and the fact that roblox has ~10 2d games out of the 50 million 3d games.