Can som1 tell me y my reticle doesnt have velocity on the first press once its reached the edge?

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
TheCollector
Posts: 41
Joined: August 1st, 2019, 9:57 pm

Can som1 tell me y my reticle doesnt have velocity on the first press once its reached the edge?

Post by TheCollector » August 3rd, 2019, 1:32 am

Here's the code for the borders and the pixels.
As it stands, you reach the edge and then you have to press the arrow key twice, once to get it to move a space then a second time to get it to move with velocity. No clue why it's doing this. Also, why does the + -17 work in B top border?

Code: Select all

 	//B right border
	if (bx + 35 >= gfx.ScreenWidth)
	{
		bx = gfx.ScreenWidth - 37;
	}
	//B left border
	if (bx + 33 <= 1)
	{
		bx = 0 + -30;
	}
	//B top border
	if (by + 19 <= 1)
	{
		by = 0 + -17;
	}
	//B bottom border
	if (by + 23 >= gfx.ScreenHeight)
	{
		by = gfx.ScreenHeight - 24;
	}


	//Boat gfx
	//Upper
	gfx.PutPixel(30 + bx, 20 + by, 0, 255, 0);
	gfx.PutPixel(31 + bx, 20 + by, 0, 255, 0);
	gfx.PutPixel(32 + bx, 20 + by, 0, 255, 0);
	gfx.PutPixel(33 + bx, 20 + by, 0, 255, 0);
	gfx.PutPixel(34 + bx, 20 + by, 0, 255, 0);
	gfx.PutPixel(35 + bx, 20 + by, 0, 255, 0);
	//Lower
	gfx.PutPixel(31 + bx, 21 + by, 0, 255, 0);
	gfx.PutPixel(32 + bx, 21 + by, 0, 255, 0);
	gfx.PutPixel(33 + bx, 21 + by, 0, 255, 0);
	gfx.PutPixel(34 + bx, 21 + by, 0, 255, 0);
Last edited by TheCollector on August 3rd, 2019, 1:42 am, edited 1 time in total.

albinopapa
Posts: 3790
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Can som1 tell me y my reticle doesnt have velocity on the first press once its reached the edge?

Post by albinopapa » August 3rd, 2019, 1:42 am

Once the boat reaches the edge of the screen the velocity is still going in that direction. Stop the velocity and it should take only one press after that to get the boat going another direction
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

TheCollector
Posts: 41
Joined: August 1st, 2019, 9:57 pm

Re: Can som1 tell me y my reticle doesnt have velocity on the first press once its reached the edge?

Post by TheCollector » August 3rd, 2019, 1:50 am

ah. Thanks again albino.

albinopapa
Posts: 3790
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Can som1 tell me y my reticle doesnt have velocity on the first press once its reached the edge?

Post by albinopapa » August 3rd, 2019, 2:28 am

np
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Post Reply