Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Need help with stopping my side scrolling in my 2D game

Author
Message
CHADALAK1
13
Years of Service
User Offline
Joined: 16th Sep 2011
Location: Sioux City
Posted: 21st Sep 2011 03:57
I need help with stopping my side scrolling with my code.



thank you to all who will help me

w00t! ^_^
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 21st Sep 2011 19:03
I'm guessing you are wanting to normally move the terrain below the Mario until he gets to the right or left edge of the map, right? At that point, you want to stop moving the terrain and move the Mario, right?
If that's the case, make two conditions.
If MarioX>max{
don't change terrainX and allow Mario to move freely
}
else{
keep MarioX constant and change terrainX
}
do the same thing if MarioX<min
You code has the right idea, just the wrong implimentation.

The fastest code is the code never written.
CHADALAK1
13
Years of Service
User Offline
Joined: 16th Sep 2011
Location: Sioux City
Posted: 22nd Sep 2011 00:47
Yes exactly what you guessed. I can see what you are trying to input for the arguement, but I cant quite get the logic right in the statement :/ my max is @ 1022. can you show me the implementation?

w00t! ^_^
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 22nd Sep 2011 20:52

Simple as that.

The fastest code is the code never written.
CHADALAK1
13
Years of Service
User Offline
Joined: 16th Sep 2011
Location: Sioux City
Posted: 28th Sep 2011 16:27
the background still scrolls when i move. :/. it almost seems like every time i move right, it remakes the new location of the background of "x" to equal "0" Dx.

w00t! ^_^
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 28th Sep 2011 22:48
Check out this section of code:

This part will allways be true:
Quote: "if(( dbRightKey() ==1 ) )&&(x< 1022))"

if you have this as-is:
Quote: " if (x > 1007)
{
x--;
}"

because "x" will never be greater than 1022. Change the second code to something like "if (x>1100){....}" or whatever value you need to make the wall for the player.

The fastest code is the code never written.

Login to post a reply

Server time is: 2024-11-19 07:39:41
Your offset time is: 2024-11-19 07:39:41