It is currently Thu Apr 18, 2024 8:42 am
"WorldVertexTransition"
{
"$basetexture" "Nature/forest_dirt_04"
"$basetexture2" "FZTextures/FZ_floor_leaves2"
"$surfaceprop" "dirt"
"$blendmodulatetexture" "nature/blendtexture01"
"%detailtype" "forest_floor_01"
}
"...............if (Key.isDown(Key.UP) && canijump){
jump = -15;
canijump = false;
}
hero.y += jump;
if (Key.isDown(Key.RIGHT)){
hero.scaleX = +1;
bg.x += -5;
holerer.x += -5;
holerer2.x += -5;
plat.x += -5;
plat2.x += -5;
tunnel.x += -5;
hero.gotoAndStop('walking');
}.................."
coder0xff wrote:I wonder if Gabe ever lies in bed at night, thinking about all the fat jokes, and just cries himself to sleep, wiping his tears away with one-thousand dollar bills.
function love.update(dt)
mouseX = love.mouse.getX()
mouseY = love.mouse.getY()
difinY2 = (mouseY - pointtwoY)
difinX2 = (mouseX - pointtwoX)
--POINT ONE, MOVE TOWARDS THE MOUSE
acthyp2 = math.sqrt( (difinX2 * difinX2) + (difinY2 * difinY2) )
proportion2 = (speed2 / acthyp2)
yforce2 = (difinY2 * proportion2)
xforce2 = (difinX2 * proportion2)
pointtwoX = pointtwoX + (xforce2 * dt * 1)
pointtwoY = pointtwoY + (yforce2 * dt * 1)
love.graphics.draw(ball2, pointtwoX, pointtwoY, r ,sx,sy,32,32)
-----------------------------
difinY = (pointtwoY - ballY)
difinX = (pointtwoX - ballX)
--BALL MOVE TOWARDS POINT TWO (which is actually point one)
acthyp = math.sqrt( (difinX * difinX) + (difinY * difinY))
proportion = (speed / acthyp)
yforce = (difinY * proportion)
xforce = (difinX * proportion)
ballX = ballX + (xforce * dt * 1)
ballY = ballY + (yforce * dt * 1)
love.graphics.draw(ball, ballX, ballY, shiprotation ,sx,sy,32,32)
--FACE THE MOUSE
if pointtwoX ~= (ballX+32)then
if pointtwoX > (ballX+32) then
shiprotation = (math.atan(difinY / difinX))
end
if pointtwoX < (ballX+32) then
shiprotation = (math.atan(difinY / difinX) + math.rad(180))
end
else
if pointwoY > (ballY+32) then
shiprotation = (math.rad(90))
else shiprotation = (math.rad(270))
end
end
end
.treeturtle-- wrote:oh, and since sharing random code seems to be the thing to do then TADA! its LUA!
this is some simple trig stuff to make a ball follow the mouse. It took me a while to think of but I finally did. Now, a day later I see that I need to completely rewrite it and start over using a different method if i hope to fully get the desired movement... curse you math!
- Code: Select all
function love.update(dt)
mouseX = love.mouse.getX()
mouseY = love.mouse.getY()
difinY2 = (mouseY - pointtwoY)
difinX2 = (mouseX - pointtwoX)
--POINT ONE, MOVE TOWARDS THE MOUSE
acthyp2 = math.sqrt( (difinX2 * difinX2) + (difinY2 * difinY2) )
proportion2 = (speed2 / acthyp2)
yforce2 = (difinY2 * proportion2)
xforce2 = (difinX2 * proportion2)
pointtwoX = pointtwoX + (xforce2 * dt * 1)
pointtwoY = pointtwoY + (yforce2 * dt * 1)
love.graphics.draw(ball2, pointtwoX, pointtwoY, r ,sx,sy,32,32)
-----------------------------
difinY = (pointtwoY - ballY)
difinX = (pointtwoX - ballX)
--BALL MOVE TOWARDS POINT TWO (which is actually point one)
acthyp = math.sqrt( (difinX * difinX) + (difinY * difinY))
proportion = (speed / acthyp)
yforce = (difinY * proportion)
xforce = (difinX * proportion)
ballX = ballX + (xforce * dt * 1)
ballY = ballY + (yforce * dt * 1)
love.graphics.draw(ball, ballX, ballY, shiprotation ,sx,sy,32,32)
--FACE THE MOUSE
if pointtwoX ~= (ballX+32)then
if pointtwoX > (ballX+32) then
shiprotation = (math.atan(difinY / difinX))
end
if pointtwoX < (ballX+32) then
shiprotation = (math.atan(difinY / difinX) + math.rad(180))
end
else
if pointwoY > (ballY+32) then
shiprotation = (math.rad(90))
else shiprotation = (math.rad(270))
end
end
end
//assuming dt is time delta
difinY2 = (mouseY - pointtwoY)
difinX2 = (mouseX - pointtwoX)
step = 1 - math.exp(-dt * speed)
pointtwoY += difinY2 * step
pointtwoX += difinX2 * step
coder0xff wrote:No offense Banter, but I think VMT script - though maybe difficult - counts as coding just about as much as HTML does (which means not at all). Specifically, it's a document markup format, not a programming language.
Zipfinator wrote:There's only a blendtexture01. Don't bother finding others. I've seen the .vtf in the GCF and there are no others around it.
coder0xff wrote:
Got some suggestions for ya. If you are just trying to make pointtwo move towards the mouse (and it looks like the further away it is the less aggressively it accelerates as you have it now? is it supposed to be like gravity? lemme know cause the equation's completely different). This equation makes it move fast if it's far away, and slows as it approaches the mouse, and is correctly integrated over time if you have loss of frame rate.
If you are trying to do a system where momentum is preserved and force is used to accelerate the point towards the mouse and then decelerate so that it stops when it reaches the mouse, it's a little more difficult (unless you know how).
Also, you may want to look into the function math.atan2(y, x). It automagically determines which quadrant you're in so you don't have to do all that extra stuff you got at the end there.
Major Banter wrote:On a side note, HTML is incredibly complicated and I think being elitist about what specifically counts as code
Major Banter wrote:On a side note, HTML is incredibly complicated and I think being elitist about what specifically counts as code is demotivating and decidely arrogant. No offence, that's my reading of what you've typed.
A code is a rule for converting a piece of information (for example, a letter, word, phrase, or gesture) into another form or representation (one sign into another sign), not necessarily of the same type.
Users browsing this forum: No registered users