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.

Newcomers DBPro Corner / Hello, I need help with scroll object texture

Author
Message
Amaris
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location:
Posted: 9th Mar 2015 18:05
I am trying to figure out What I am doing wrong.

Here is my set up

I am creating a 2d game with a 3d object world but everything is still sprites.

All my sprites are following boxes and the boxes get collision with the 3d world.

I am setting up a 3d plane in the back ground textured, And when I move the player box the back ground texture scrolls.

It all works perfectly until I get collision and stop, If my player is stopped due to collision my back ground texture still scrolls as I am still pressing the move button.


Any suggestions?

Here is my scroll texture code if any one has any good ideas, thanks.

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 10th Mar 2015 12:57 Edited at: 10th Mar 2015 12:57
There are a couple of ways I can think of off the top of my head to handle this:

1.) Use another variable that indicates whether or not the player is actually moving. Include this variable in a IF / ENDIF including the LeftStickx and TightTrigger checks, i.e.:



2.) Do the collision check and player movement within the same function / subroutine - if no collision, check the LeftStickx and RightTrigger for movement

If it were me, I would go with option 2.

So many games to code.....so little time.
Amaris
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location:
Posted: 10th Mar 2015 17:43
Hi LBFN

My problem is I do not think there is any way to tell if your object is moving or to put it in a variable as there is nothing to equal the movement to as he is still considered moving even if he is stopped.

I have been trying to use collision, But the other problem I am having is My player box is always having collation on his feet.

Now If I could check for z collision this would work.

Is there a way to check just for z collision?

I'm lost.
luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 10th Mar 2015 19:05
Show me how you handle LeftStickx and RightTrigger.You have to change them in some way which creates an exception when you hit and obstacle and move at the same time.Also it's relevant how you handle collision.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Amaris
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location:
Posted: 10th Mar 2015 19:32
Luskos, Hi

I am using sparky's collision

And this is how I am moving



I don't understand why we just can not have a variable built in the system telling if a object is moving or not.

This would be nice, if object moving()=1
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 10th Mar 2015 20:53
Hi Amaris,

You only allow for movement if there is no collision. It would be fairly easy to code. I am interested in the subroutine or function you use when checking for collision.

Quote: "
I don't understand why we just can not have a variable built in the system telling if a object is moving or not."


You can make / use a variable yourself; you don't need a system variable to do that. Still, coding it without using an additional variable is what I recommended.

So many games to code.....so little time.
Amaris
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location:
Posted: 10th Mar 2015 21:09
Thanks lbfn

Here is the function I use, most of it is from the original function in sparkys sliding demo.


I would write my own variable but am confused what to use as it is not my own function. Thank you for any help with this.

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 11th Mar 2015 03:12
The first collision is checking for whether or not the player has collided with the ground. The second collision is more intended for colliding with whatever objects are in group 1. You should use the second collision to determine if you need to scroll the background. There is no need to add another variable to control it. If you are colliding, no background scroll. If you aren't colliding, scroll away. You could easily do this by putting in an else statement.



I can't run your code to check it, but it seems like this would work. Please give it a try and let me know how it works out.

So many games to code.....so little time.
Amaris
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location:
Posted: 11th Mar 2015 04:55
LBFN

Success, it worked, Nice to meet you

Here is the solution, Thank you so much.

Login to post a reply

Server time is: 2024-11-27 05:39:56
Your offset time is: 2024-11-27 05:39:56