Chaos Project

Game Development => Sea of Code => Topic started by: G_G on August 14, 2010, 05:56:06 pm

Title: [C#] RPG Editor Help
Post by: G_G on August 14, 2010, 05:56:06 pm
Basically I'm trying to create an RPG Editor for me and Munkey's engine made in XNA. And I started creating the user interface for the actors and thats when I got stumped here. Everything else for the actors is easy. I also might need help for other things as well. Anyways I'm gonna keep this topic for any help I need creating this editor.


Problem 1
Spoiler: ShowHide
I've messed around with Bitmaps a bit in c# but not a whole lot. First let me say that I'm trying to create something like in the RPGXP Database under actors, I want to be able to create those parameter stat editors. The MaxHP, SP, STR, etc.

I can do it if I know how to do this.
-When a picture box is clicked, I want the mouse position relative to the picture box, so if I click in the top left corner of a picture box, the position will be 0, 0
-Drawing a colored line on a bitmap, from top to bottom. The height being a percent from where the bitmap was clicked on. So if it was 0, 0, the height would be 100% and draw the line completely from top to bottom. Or if it was 0, 10, it'd be 90% and it'd draw the line from 0,10 to the bottom.
-Some sort of algorithm for the Generate a Curve button.



Title: Re: [C#] RPG Editor Help
Post by: Blizzard on August 15, 2010, 04:04:43 pm
Use my Unlimited Levels for curve generation algorithms.
Title: Re: [C#] RPG Editor Help
Post by: Ryex on August 15, 2010, 04:32:15 pm
with the draw thing, use the drawing to generates the stats, THEN uses the stats to draw the image
Title: Re: [C#] RPG Editor Help
Post by: G_G on August 16, 2010, 11:27:19 am
Well oddly enough when making an RMXP Sprite Animator I learned how to do everything I needed, except the mouse clicking part as in get the mouse coordinates relative to the control.
Title: Re: [C#] RPG Editor Help
Post by: Ryex on August 16, 2010, 11:33:06 am
can you get the mouse coordinates relative to the window? if so just use the position of the control
Title: Re: [C#] RPG Editor Help
Post by: G_G on August 16, 2010, 11:40:46 am
I was trying to find that as well. No luck yet, but google hates me so meh.
Title: Re: [C#] RPG Editor Help
Post by: winkio on August 16, 2010, 11:55:54 am
1.  Get mouse coordinates on screen
2.  Get window coordinates on screen
3.  Get picture coordinates on window
4.  Add window coordinates to picture coordinates to get picture coordinates on screen
5.  Compare
Title: Re: [C#] RPG Editor Help
Post by: G_G on August 16, 2010, 12:02:30 pm
So this
Window X = 100
PicBox X = 10
Mouse X = 110 (clicked on left corner pixel)

Ah I see, Just subtract window position and picbox position from mouse position. Thanks winkio xD
Title: Re: [C#] RPG Editor Help
Post by: Blizzard on August 16, 2010, 03:53:38 pm
Why don't you just use an OnClick event? Each control should be able to assign a callback function/method for mouse clicks.
Title: Re: [C#] RPG Editor Help
Post by: G_G on August 16, 2010, 04:47:29 pm
Good point .-.
and I tried using one of your algorithms, apparently you cant do ** in c#. I dont even know what that does.
Title: Re: [C#] RPG Editor Help
Post by: Blizzard on August 16, 2010, 05:36:43 pm
It's the power function.

x ** y in Ruby = Math.Pow(x, y) in C#
Title: Re: [C#] RPG Editor Help
Post by: G_G on August 16, 2010, 05:39:24 pm
Ah. Okay that helps thanks. For now resolved but I may have more questions later.
Title: Re: [C#] RPG Editor Help
Post by: Blizzard on August 16, 2010, 05:43:35 pm
Sure thing, pretty girl. *points at your avatar* But you know it's gonna cost ya. This merchandise ain't for free, ya know. :V
Title: Re: [C#] RPG Editor Help
Post by: G_G on August 16, 2010, 07:22:20 pm
Lol xD