Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Request a Tutorial
Index -> Programming, Turing -> Turing Tutorials
Goto page Previous  1, 2, 3 ... , 16, 17, 18  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Tony




PostPosted: Fri Dec 07, 2012 10:05 pm   Post subject: RE:Request a Tutorial

probably with the use of Mouse.Where and Font.Draw
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
QuantumPhysics




PostPosted: Sat Dec 08, 2012 1:36 am   Post subject: RE:Request a Tutorial

And simple addition and subtraction!
JakeTakeLake




PostPosted: Thu May 16, 2013 2:47 pm   Post subject: RE:Request a Tutorial

I really need a tutorial on ragdoll physics! Like seen in this video: http://youtu.be/bkuOQ6rsjvQ

Maybe this is too hard for turing; I have no idea how to do this. I would really appreciate a tutorial!
Nathan4102




PostPosted: Thu May 16, 2013 3:10 pm   Post subject: RE:Request a Tutorial

That would require a decent physics engine, especially if done in 3d. Way too hard for a novice programmer, way too much effort for an experienced one.
Raknarg




PostPosted: Thu May 16, 2013 6:16 pm   Post subject: RE:Request a Tutorial

haha yeah I'm still trying to figure out how to make a decent physics engine. Colliding objects are hard to deal with
andrew.




PostPosted: Sat May 18, 2013 1:28 pm   Post subject: RE:Request a Tutorial

I don't believe that the choice of programming language plays a huge part in building a basic physics engine from scratch. I think the most difficult part would be figuring out the math behind all the physics calculations.
Nathan4102




PostPosted: Sat May 18, 2013 1:44 pm   Post subject: RE:Request a Tutorial

I don't think turing is capable of running a physics engine at a reasonable speed though (Like a ragdoll game)
Raknarg




PostPosted: Sat May 18, 2013 1:56 pm   Post subject: RE:Request a Tutorial

Actually, it is. Someone released a game some time ago that I have on my computer that has a great physics engine in turing. It's all a matter of your efficiency.
Sponsor
Sponsor
Sponsor
sponsor
Nathan4102




PostPosted: Sat May 18, 2013 2:11 pm   Post subject: RE:Request a Tutorial

So Turing can run a physics engine, but can't play music without severe lag... :/
Raknarg




PostPosted: Sat May 18, 2013 10:41 pm   Post subject: RE:Request a Tutorial

No, it can play music fine. Perhaps you're just doing it weird.
Nathan4102




PostPosted: Sat May 18, 2013 10:50 pm   Post subject: RE:Request a Tutorial

This is one of the first things I made in turing, a crappy jumpscare game. Compare the speed with music, and the speed without music. What am I doing wrong?

http://www.2shared.com/file/atWj5BI9/Ball_game.html
JakeTakeLake




PostPosted: Sat May 18, 2013 10:56 pm   Post subject: RE:Request a Tutorial

Maybe just a joint physics tutorial? For example, limbs that you can rotate by clicking and dragging them? This would be amazing
Insectoid




PostPosted: Sun May 19, 2013 7:50 am   Post subject: RE:Request a Tutorial

Rotating around a point is fairly simple, though it requires some trigonometry. Say you want to rotate around the point (x,y) in the image by n degrees. You should first calculate how far that point is from the centre (you can use Math.Distance for this). Since Turing can only rotate images through their centres by default, once you rotate the image, the point (x,y) will have moved. You need to figure out where it moved to. The distance of the point from the centre will not have changed, and you know the angle it moved through. This forms a right triangle. Using sine law (remember SOH CAH TOA from 10th grade math?) you can calculate where the point is relative to the centre of the image. This tells you how much you need to shift the image by.




code:

function rotate (x,y,n) %rotate n degrees around (x,y)
    hypotenuse = Math.Distance (centreX, centreY, x, y) //calculate the distance between (x,y) and the centre
    Pic.Rotate(image, n) //rotate the image around the centre
    offsetX = hypotenuse * cosd(n) + 0.5*Pic.Width(image) //gives the new x relative to the centre
    offsetY = hypotenuse * sind(n) + 0.5*Pic.Height(image) //gives the new y relative to the centre
    centreX += (offsetX - x) //translate the image so that (offsetX, offsetY) = (x,y)
    centreY += (offsetY - y)



There's probably a few mistakes in there, since I wrote it on the fly and didn't bother testing it, but it demonstrates the concept and you could probably get this working in Turing.

The real challenge in a physics engine is figuring out where the rotation point is.
JakeTakeLake




PostPosted: Sun May 19, 2013 11:56 am   Post subject: RE:Request a Tutorial

Thanks I understand how to rotate the image, its actually pretty easy. But, how do I translate the image after its been rotated so that it rotates on a specific spot on the image, as opposed to the center?
Insectoid




PostPosted: Sun May 19, 2013 12:18 pm   Post subject: RE:Request a Tutorial

If you read my post, you'd realize that I did that.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 17 of 18  [ 261 Posts ]
Goto page Previous  1, 2, 3 ... , 16, 17, 18  Next
Jump to:   


Style:  
Search: