elitepvpers

elitepvpers (https://www.elitepvpers.com/forum/)
-   CO2 Programming (https://www.elitepvpers.com/forum/co2-programming/)
-   -   move object around circle on c# (https://www.elitepvpers.com/forum/co2-programming/1778865-move-object-around-circle-c.html)

injection illusion logic 03/21/2012 15:40

move object around circle on c#
 
this isn't related to co
if u got 2 object , circle and image (or another small circle)
how to let the small circle goes around the big one (from it's center it's center throw the circumstance of the big one) , well what about the small one spin around itself ?

i was trying to do this but Graphics >> creategraphics dont actually gives u the graphic u created as object , it just draw it -.-

any idea or link will be appreciated ..

p.s dont try to get coords throw the big circle being object , try to get it from radius (as every coordinate on the circle is an end point of a radius and it's projection is a 90 degree , which actually it's projection is Y and triangle third side is the X ;) wish it made sense)

shitboi 03/21/2012 19:12

not sure what you're asking... if you want a small circle to be moving on the circumference of the bigger circle, you can definitely use the right angled triangle method to assign new coordinate for your small circle, and redraw it. Iterate the pre mentioned procedure you will be able to get the small circle moving.

injection illusion logic 03/22/2012 02:48

true but that's in case the big circle is actually an object which i cant do in c# that's why im asking for help
for example
Quote:

Pen pencolor2 = new Pen(Color.Red);
Graphics draw;
r = d1 / 2;
draw = CreateGraphics();
draw.DrawEllipse(pencolor2, forx(350, r), fory(150, r), d1, d2);
now after i draw a circle , how will i use it and it's just a line o-0
aka it's not an object unlike picture
Quote:

sumopic.Location = new System.Drawing.Point(forx(350,50),fory(150,50));
got my point ?
P.S forx,fory is just methods editing the center as create graphics always using the upper left vertex to draw from not mid point

edit : here is the math
Quote:

int circlePosX = centerX + Math.Cos(degrees) * radius;
int circlePosY = centerY + Math.Sin(degrees) * radius;

where timmer ticks and the angel(degrees) set the speed and this prev method is the path
anyone ?

pro4never 03/26/2012 21:07

Yes, I actually bothered to log in to answer this because it both intrigued me (yay graphics) and confused me (yay stupid me).

#1: If you're dealing with graphics... use a graphics framework. XNA is fantastic and super powerful.

#2: If you insist on using base C# then either A: apply proper graphics procedures or B: write in a way that fits with application approach to programming.


If you do wish to work without a framework then you want what amounts to a game loop.

In this case you clear the entire screen and then re-draw the 'current' frame every time you wish to update. This is messy because you're trying to mix your approaches and you loose any benefit or controlability that using a gameloop would give you when used in the proper context (again, look at xna)

If you want to stick with the application type approach then it's also very simple... Instead of using a pen tool to draw an elipse, create an image to represent your circle (can be done programatically from inside the program) and simply move the location of this image around another image.

To clarify, when I say you can create it from inside the program I mean you can manually assign the pixel values for the image to draw a circle as you wish it to look.

injection illusion logic 03/27/2012 18:56

fuck my question the most awesome thing that i saw u here once again :D :D
and yes if u r drawing in an imagebox it wont be effected with the graphic update which wont remove all what u draw at refresh(ex: minimizing and once any other object move on them)
but yeah framwork with xna is amazing , was trying to build it as native c# but when i used xna it saved alot for me
about image box it's hard to interact with another objects (aka if u got a picture of png with a transparent background it will still not show what's under it which is called layers in photoshop)
thanks once more for the reply and really happy that u logged in to reply :D


All times are GMT +2. The time now is 06:40.

Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.