Jump to content


T194

Member Since 12 Mar 2011
Offline Last Active Apr 07 2013 10:08 AM

Posts I've Made

In Topic: Drawing lines to approximate a curve

03 August 2012 - 08:45 PM

this method only works with the sin and cos, because they work with angles, while your formula works with a grid.
once you work with angles, the relationship between the triangles is very clear, since they are all the same, only on a different location and angle.

Thanks that's great, yours is a much more logical way of doing it. :thumbsup:

In Topic: relative hspeed

31 December 2011 - 10:51 AM

I have just come back to this project and I'd really appreciate some help. I'm surprised no ones needed this before.

Heres a final shot at trying to explain what I need. I'm attempting vehicle physics. I have a car which movement is in terms of x and y. This car could be facing in any direction and moving in any direction. What I need to find is its movement in terms of the image_angle, so how fast it is moving sideways and how fast forward (parallel and perpendicular to the direction the driver faces).  

I've changed the ^ and radians bits of the code, but this doesn't make much difference. If anyone could give me a hand with this I'd be very grateful.

In Topic: Saving games

13 December 2011 - 11:43 AM

I'm not sure I quite understand what your asking but using the read/write to ini functions allows you to save and load variables to and from a file with relative ease. Look up the functions in the help file (under ini's). I find that often its not necessary to save that much information really, maybe you don't need to save all the information your trying to get into one object.

In Topic: Graphics software

12 December 2011 - 06:06 PM

I am not too sure about how GIMP handles animation, but it is what I and my designers all use until we can get to the point of purchasing Adobe CS5. The nice thing about it is that it is free for private and commercial use and it has plenty of extensions that you can add on to it that are made by the community. I really recommend giving it a shot.


t doesn't look like it does animation but thanks, I'll take a closer look at it. It seems everyone either wants or has adobe for graphics. I do have Photoshop but its animation capabilities are very limited.  There don't seem to be many commercial (but cheaper) alternatives to adobe though, someone mention coral, so I might look at that as well.

In Topic: relative hspeed

06 November 2011 - 07:31 PM

I cannot view your image, nor do I know what you mean with 'relative speed'. Compared to what object or moving point? And what is 'the rooms x and y'? Might you be talking about a view?
Anyway, in your code I see two things many people get wrong, and might be the root of your problem. I'm not sure if you did, though, but I'll share it anyway.
'^' is the bitwise xor operator, not x to the power of [n]. For that, you need power(x,n). If you only want to square it, use sqr(x). So the first line of your code should be written like this:

_vel_mag = sqrt(sqr(v_x)+sqr(v_y))
In sin(x) and cos(x), x must be in radians. You can convert using degtorad() and radtodeg(), or the convertion formula itself as it's easy to use...

I knew about sinx and cosx in radians, I think I copied an old version of the code. I never realised that ^ isn't power though! I guess that's why code involving powers has never worked that well.

Maybe I didn't explain what I'm trying to do very well though. The object (a vehicle) can rotate and move in 2 dimensions, as its a top down game. For the physics of the vehicle, i wanted to split its motion into horizontal and vertical components relative to the car. The car need not be moving in the direction it is facing (I've called this v_y) it could also be moving sideways (v_x). The code is meant to find the hspeed and vspeed components of say the v_x direction. It's hard to explain, but I'll see if the modifications of ^: power makes a difference.