User Tag List

Results 1 to 10 of 10

Thread: Weird Bug With Screen->Arc Drawing

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Keese ywkls's Avatar
    Join Date
    Feb 2016
    Posts
    62
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    481
    Level
    7
    vBActivity - Bars
    Lv. Percent
    90.4%
    I'm confused... is startangle or endangle supposed to be larger?
    I think part of this is due to the fact the Arc works counterclockwise and everything else rotates in the opposite direction.
    Strangely, the function seems to do what it is supposed to even if either is true? (Startangle is smaller or larger than endangle)
    I hadn't tried WrapDegrees yet (couldn't remember what it did) so I wrote up this version instead.

    Code:
    angle = Angle(this->X+24, this->Y+8,Link->X+8,Link->Y);
    angle*=-1;
    if(angle<0)
          angle+=360;
    Since adding 360 to the negative angle would have it rotate to the exact same angle(only positive) I thought that might work.
    But, that hasn't proven to be the case.
    Looking at WrapDegrees, I'm not sure it'd be better; but I'll try it and post the results afterward.

  2. #2
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,765
    Level
    21
    vBActivity - Bars
    Lv. Percent
    69.74%
    Quote Originally Posted by ywkls View Post
    I'm confused... is startangle or endangle supposed to be larger?
    I think part of this is due to the fact the Arc works counterclockwise and everything else rotates in the opposite direction.
    Strangely, the function seems to do what it is supposed to even if either is true? (Startangle is smaller or larger than endangle)
    I hadn't tried WrapDegrees yet (couldn't remember what it did) so I wrote up this version instead.

    Code:
    angle = Angle(this->X+24, this->Y+8,Link->X+8,Link->Y);
    angle*=-1;
    if(angle<0)
          angle+=360;
    Since adding 360 to the negative angle would have it rotate to the exact same angle(only positive) I thought that might work.
    But, that hasn't proven to be the case.
    Looking at WrapDegrees, I'm not sure it'd be better; but I'll try it and post the results afterward.

    EndAngle should be higher. Try running your code with the debugging function that I posted.

  3. #3
    Keese ywkls's Avatar
    Join Date
    Feb 2016
    Posts
    62
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    481
    Level
    7
    vBActivity - Bars
    Lv. Percent
    90.4%
    Quote Originally Posted by ZoriaRPG View Post
    EndAngle should be higher. Try running your code with the debugging function that I posted.
    I feel almost like Arc needs a conversion function to work easily with other stuff, since it is so non-intuitive.
    As I posted on Discord, I was confused because the correct (and incorrect) results happened both when startangle was larger and when it was smaller.

    Using the function you posted, I changed the code like so...
    Code:
    //Section 120. Eye Sentry
    
    ffc script Eye_Sentry{
    	void run(int item_id, int perm, bool left){
    		bool triggered = false;
    		float angle;
    		int sfxTimer;
    		if(Screen->D[perm]==1)
    			triggered= true;
    		while(!Link->Item[item_id])
    			Waitframe();
    		//Screen->D[perm]=1;
    		this->Data++;
    		while(!triggered){
    			if(left){
    				angle = Angle(this->X+24, this->Y+8,Link->X+8,Link->Y);
    				//angle*=-1;
    				Arc(3, this->X+24, this->Y+8, 256, angle-10,angle+10, 1, 1, 0, 0, 0, true, true, OP_TRANS,true);	
    				
    			}
    			else{
    				angle = Angle(this->X+8, this->Y+8,Link->X+8,Link->Y);
    				//angle*=-1;
    				Arc(3, this->X+8, this->Y+8, 256, angle-10,angle+10, 1, 1, 0, 0, 0, true, true, OP_TRANS,true);	
    				
    			}
    			//Create sound every sixty seconds.
    			if ( sfxTimer == 0 ) Game->PlaySound(SFX_X_RAY);
    			sfxTimer = (sfxTimer+1)% 60;
    			Waitframe();
    		}
    		this->Data=GH_INVISIBLE_COMBO;
    	}
    }
    I didn't get the screen-covering effect, just an arc that was on the opposite side of the screen from what I wanted.
    I'm not sure about the best way to rotate it to where it should be.
    I'd previously used angle *=-1 but that didn't really work. Nor did using WrapDegrees on the outcome of that.

    Any suggestions? My alternative is to use a versiion of Screen->Triangle Moosh provided which I've already gotten to replicate the effect I want.
    (Hence my interest here is mostly to find the cause of this.)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social