Hi everyone,
I've been trying to solve the problem of the cursor hitting the edges of the screen
so i did exactly what chili did in the video https://www.youtube.com/watch?v=UREKHWv ... m1w03c010c 9:40
I set the values and everything to the same he did but my program still crashes when it hits the bottom of the screen , I wonder if someone could help me figure out the reason :
if (x + 5 > gfx.ScreenWidth) {
x = gfx.ScreenWidth - 6;
vx = 0;
}
if (y + 5 >= gfx.ScreenHeight) {
y = gfx.ScreenWidth -6;
vy = 0;
}
if (y - 5 < 0) {
y = 5;
vy = 0;
}
if (x - 5 < 0) {
x = 5;
vx = 0;
}
Beginner C++ Game Programming DirectX Tutorial 5
-
- Posts: 3
- Joined: August 18th, 2017, 10:25 am
Re: Beginner C++ Game Programming DirectX Tutorial 5
if (y + 5 >= gfx.ScreenHeight) {
y = gfx.ScreenWidth -6;
vy = 0;
}
Exactly what I did huh?
y = gfx.ScreenWidth -6;
vy = 0;
}
Exactly what I did huh?
Chili
-
- Posts: 3
- Joined: August 18th, 2017, 10:25 am
Re: Beginner C++ Game Programming DirectX Tutorial 5
chili wrote:if (y + 5 >= gfx.ScreenHeight) {
y = gfx.ScreenWidth -6;
vy = 0;
}
Exactly what I did huh?
OMG I've been trying for like an hour or so
thank you so much
Re: Beginner C++ Game Programming DirectX Tutorial 5
Np bro. You just ask the same question in the comments btw?
Chili
-
- Posts: 3
- Joined: August 18th, 2017, 10:25 am
Re: Beginner C++ Game Programming DirectX Tutorial 5
Yes ! I accidentally deleted my reply on my comment so I couldn't see if i got replies so I just asked here again.chili wrote:Np bro. You just ask the same question in the comments btw?