Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2/4/11
#1
  • Tool picking up/dropping works again, and
  • Tools are now dropped where you are pointing instead of on your head
  • getAngle() member function for tools; this returns the angle between the player's body and the mouse
  • moveTo(position, part) member function for models. The specified part will be moved to the given position, and the other parts in the model will be moved with it.

Here is an example of getAngle(). Put this script in a tool, then click to throw balls.

Code:
player = script.Parent.Parent.Parent
character = player.Character
body = character.Body
link(script.Parent.MouseDown, function(b)
    if b == 1 then
        local a = math.rad(script.Parent:getAngle()) --it returns degrees, we need radians to use sin and cos
        local x = math.cos(a) --get the x and y components of the angle
        local y = math.sin(a)
        local position = Vec2D(body.Position.x + x * 4, body.Position.y + y * 4) --Position of the ball
        local p = create("Circle")
        p.Position = position
        p.Velocity = Vec2D(x * 20, y * 20) --Give it some velocity
        p.Color = Color(200, 0, 0)
        p.Parent = game.World
    end
end)
Reply


Messages In This Thread
2/4/11 - by Jacob__mybb_import1 - 02-05-2011, 12:55 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)