Jump to content


Photo

Weird Bug With Drawing Lines


  • Please log in to reply
6 replies to this topic

#1 Raidation

Raidation

    Java Programmer

  • New Member
  • 341 posts
  • Version:GM8

Posted 31 December 2009 - 03:40 AM

I'm working on a project, and I've run into a really weird error.
Posted Image

Posted Image

As you can see, there's a weird  line from (0,0) following my character. I just want the character to leave a path.

The Source

It's GM8 registered.
Can somebody help me get rid of this?

[Edit]
And there's another bug, too. The o_lightwall object doesn't store the coordinates when the character travels along the border of the screen.

Edited by Raidation, 31 December 2009 - 03:43 AM.

  • 0

#2 jabelar

jabelar

    GMC Member

  • New Member
  • 2980 posts

Posted 31 December 2009 - 03:55 AM

Well, the line is being drawn (obviously) by your draw_line() statement in the o_lightwalls object's Draw event. If you comment out that code the problem goes away. I'm not going to try to figure out what you're trying to do with that line (you didn't explain what you want to achieve with the line), but you just need to check what the values are (use show_message() or something to help monitor the values) and I'm sure you'll figure out why it isn't drawing where you want it to.

Edited by jabelar, 31 December 2009 - 03:55 AM.

  • 0

#3 Raidation

Raidation

    Java Programmer

  • New Member
  • 341 posts
  • Version:GM8

Posted 31 December 2009 - 04:04 AM

oh, well I want all the lines there except for the one that's coming from the point (0,0).
I want to draw the path that the character's following.
  • 0

#4 Obj_Control

Obj_Control

    GM Mentor

  • New Member
  • 2561 posts

Posted 31 December 2009 - 05:07 AM

This happened to me once when I was trying to draw the path of a path resource. I used a loop going through all the points, but never found out why it would draw from 0,0 and then the path. I've even tried making it loop from the second to before last point, but the problem persisted.

Summary: It's not only you, I can't help you, I hope you solve this.

Off topic: Small game you got there. Are you by chance working on the competition?
  • 0

#5 Raidation

Raidation

    Java Programmer

  • New Member
  • 341 posts
  • Version:GM8

Posted 31 December 2009 - 02:58 PM

I just solved the (0,0) problem this morning. In my loop in the Draw event, I put i <= ds_list_size(polyx);
It should have been i <= ds_list_size(polyx)-1;

Now comes the problem of not storing the points when it's on the border...

Yeah, it's for the competition. 240x160 screen size (GBA).
  • 0

#6 ragarnak

ragarnak

    GMC Member

  • Retired Staff
  • 19468 posts
  • Version:GM8

Posted 31 December 2009 - 03:02 PM

It should have been i <= ds_list_size(polyx)-1;

I though it would be a problem like that (but could not check as I do not have v8.0 installed). But instead of adding the "-1" to it, simply change the "<=" to "<"
  • 0

#7 Raidation

Raidation

    Java Programmer

  • New Member
  • 341 posts
  • Version:GM8

Posted 31 December 2009 - 03:12 PM

Ah... yes, that would make the game smaller. Thank you. :P
And I've solved the other problem, too. Apparently, I think faster when it's 6:00 in the morning vs. 9:00 at night. O.o

In my step event of o_lightwalls, I had if((ds_list_find_value(polyx,ds_list_size(polyx)) != o_atrum.x && ds_list_find_value(polyy,ds_list_size(polyy)) != o_atrum.y)) {

It should have been if((ds_list_find_value(polyx,ds_list_size(polyx)-1) != o_atrum.x || ds_list_find_value(polyy,ds_list_size(polyy)-1) != o_atrum.y)) {

Well, close this topic if you want, since I've solved both of my problems.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users