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

Username:   Password: 
 RegisterRegister   
 Small Gap - Really upset :(
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Mackie




PostPosted: Sun Feb 28, 2010 7:57 pm   Post subject: Small Gap - Really upset :(

Hey there, long time no post. I have gotten myself in a pickle.
I am writing a game that I have a little glitch with and felt I needed to come somewhere for help. There must be an obvious answer im just missing... I'm writing this in C# using XNA 3.1 for those of whom it might concern.

Posted Image, might have been reduced in size. Click Image to view fullscreen.

You see that gap? I hate that gap. It should be right up against the circle. Does anyone have any idea what I can do?
I know _why_ this is happening, I just don't know what to do about it. Confused

Here is the code:
code:

for(int x = 0; x >= maxX; x++)
{
   if ((x <= (maxX/2)-15)||(x >= (maxX/2)+15))
   {
      spriteBatch.Draw(dot, new Vector2(x, f(x)), Color.White);

      // Correction For Graph Gaps
      int gap = f(x + 1) - f(x);
      while (gap != 0)
      {
          spriteBatch.Draw(dot, new Vector2(x, f(x) + gap), Color.White);
          if (gap > 0)
             gap--;
          if (gap < 0)
             gap++;
      }
      // END Correction For Graph Gaps
   }
   x++;
}
Sponsor
Sponsor
Sponsor
sponsor
SNIPERDUDE




PostPosted: Sun Feb 28, 2010 9:02 pm   Post subject: RE:Small Gap - Really upset :(

wow, the graphics look really cool. Mind if I ask what the game is about?
USEC_OFFICER




PostPosted: Sun Feb 28, 2010 9:33 pm   Post subject: RE:Small Gap - Really upset :(

The circle seems to be in the exact center of the gap. Either it has something to do with the way the circle is drawn, or say it's a feature.
Mackie




PostPosted: Sun Feb 28, 2010 9:39 pm   Post subject: Re: Small Gap - Really upset :(

Hey Smile
Thanks, I thought they were pretty sick to. My friend and I are doing this, with a little help from my girl friends art.

Well, when deciding exactly what to make for a game, we came to the crossroads of whether to go 2D or 3D. So we chose 1D. You have to stay on the line, and based on the waves you create on the line, you can battle advancing enemies, and avoid dimensional rifts. You can create as many waves as you'd like with your mouse by clicking and dragging, and they interfere just like any sound wave for example.

The all to familiar gap is apparent in this screen shot:

Posted Image, might have been reduced in size. Click Image to view fullscreen.

This is a mix of three waves. I still need to smooth some things out. But this is basically how the game will play out.
Mackie




PostPosted: Sun Feb 28, 2010 9:46 pm   Post subject: RE:Small Gap - Really upset :(

The gap is supposed to be in the middle of the circle. That is a good thing. The problem is on either side of the circle.
I cut off the drawing at the edged of the circle image. The fact that the image must be square makes any line approaching the circle not on a horizontal will create a gap from the point of cut off until the circle.

If the number were changed to five, then the gap would begin to fill in the circle which is also an undesired result. Confused
chrisbrown




PostPosted: Sun Feb 28, 2010 9:51 pm   Post subject: RE:Small Gap - Really upset :(

code:
if ((x <= (maxX/2)-15)||(x >= (maxX/2)+15))

What if you change that to:
code:
if ((Distance(x, f(x), circleX, circleY) > circleRadius)

Just a guess...
Zren




PostPosted: Sun Feb 28, 2010 9:59 pm   Post subject: RE:Small Gap - Really upset :(

So basically you don't want the line going inside the circle? If that's true then instead of removing that section from the domain of this function (MathSpeak), take the coordiantes (x, y) and check the distance between it and point (maxx/2, maxy/2).

Similar to Math.Distance in Turing.
Using Pythagorean Therum:
d = sqrt((x2-x1)^2+(y2-y1)^2)
throw in a abs() to make the outcome always positive.

Edit: Numnuts.
Mackie




PostPosted: Sun Feb 28, 2010 10:07 pm   Post subject: Re: Small Gap - Really upset :(

Thanks! Smile
During my research I had come across solutions similar to this, but in practice never worked out. I now know that it was because of a misplaced semicolon in my distance function. :/
Ha! Thank you everyone.
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Sun Feb 28, 2010 10:37 pm   Post subject: RE:Small Gap - Really upset :(

I expect a copy of this when it's complete.
Mackie




PostPosted: Sun Feb 28, 2010 10:43 pm   Post subject: RE:Small Gap - Really upset :(

Sure thing Smile
We actually hope to release it for the Zune, and Xbox Arcade as well.

It's our first attempt at revenue.
SNIPERDUDE




PostPosted: Sun Feb 28, 2010 11:02 pm   Post subject: RE:Small Gap - Really upset :(

Awesome. I'm going to stick to publishing open-source stuff for a good while - programming is just a hobby for me, not a profession.
Can't wait for the release!
Insectoid




PostPosted: Sun Feb 28, 2010 11:28 pm   Post subject: RE:Small Gap - Really upset :(

There WILL be a PC version available though, right? Then I just need to wait for someone to get it, then upload it to thepiratebay, then torrent it. Razz
Mackie




PostPosted: Sun Feb 28, 2010 11:32 pm   Post subject: Re: Small Gap - Really upset :(

lmao maybe there wont be a PC version with that attitude Razz

Regardless, it will most likely be share ware, or pure ad dollars anyway. Pirates always win. So why put up a fight?
SNIPERDUDE




PostPosted: Mon Mar 01, 2010 12:25 am   Post subject: RE:Small Gap - Really upset :(

And that's why I do open-source. If people are going to steal it, why not make it community based?
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 14 Posts ]
Jump to:   


Style:  
Search: