Advertising (This ad goes away for registered users. You can Login or Register)

Strange Bug in my Program

Open discussions on programming specifically for the PS Vita.
Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
Post Reply
John Dupe
Posts: 79
Joined: Sun Jun 28, 2015 9:24 pm

Strange Bug in my Program

Post by John Dupe » Tue Aug 09, 2016 3:22 am

I'm trying to re create Pong in the Vita with HenKaku, but when the ball hits the top of the screen (only the top, I've checked) it freezes and the Vita spits out a core dump. Is there anything I should be looking out for?

My code checks if the ball hit the top of the screen, and if so, negates the speed of the ball (sending it the other way)

Am I doing something wrong?
Advertising
Stuff I've done:
libvita3d

User avatar
crait
Posts: 13
Joined: Mon Aug 08, 2016 7:28 pm
Location: Dallas, Texas
Contact:

Re: Strange Bug in my Program

Post by crait » Tue Aug 09, 2016 3:48 am

Do you mind posting the code for your collision of the top of the screen? A number of popular issues come to mind when hearing this.
Advertising

John Dupe
Posts: 79
Joined: Sun Jun 28, 2015 9:24 pm

Re: Strange Bug in my Program

Post by John Dupe » Sat Aug 13, 2016 8:26 pm

crait wrote:Do you mind posting the code for your collision of the top of the screen? A number of popular issues come to mind when hearing this.

Code: Select all

		
if((ball.y + ball.radius) > SCREEN_H)
{
	ball.y = (SCREEN_H - ball.radius);
	ySpeed = -ySpeed;
}
ball is an object of a typdef struct called circle.
ySpeed is a uint32_t set to either 5 or -5.
Stuff I've done:
libvita3d

doctorgoat
Posts: 264
Joined: Sat Jan 03, 2015 12:19 am

Re: Strange Bug in my Program

Post by doctorgoat » Sun Aug 14, 2016 1:51 am

John Dupe wrote:
crait wrote:Do you mind posting the code for your collision of the top of the screen? A number of popular issues come to mind when hearing this.

Code: Select all

		
if((ball.y + ball.radius) > SCREEN_H)
{
	ball.y = (SCREEN_H - ball.radius);
	ySpeed = -ySpeed;
}
ball is an object of a typdef struct called circle.
ySpeed is a uint32_t set to either 5 or -5.
You should definitely be using a signed int for negative numbers.

John Dupe
Posts: 79
Joined: Sun Jun 28, 2015 9:24 pm

Re: Strange Bug in my Program

Post by John Dupe » Sun Aug 14, 2016 5:31 am

***. I knew it was something simple, sometimes you just need a fresh pair of eyes to check over your code, eh?
Stuff I've done:
libvita3d

John Dupe
Posts: 79
Joined: Sun Jun 28, 2015 9:24 pm

Re: Strange Bug in my Program

Post by John Dupe » Sun Aug 14, 2016 9:20 pm

Nevermind. ySpeed is now defined as a signed int, but the problem persists.
Stuff I've done:
libvita3d

Post Reply

Return to “Programming and Security”