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 / Code Check

Author
Message
Oboro
14
Years of Service
User Offline
Joined: 27th Jul 2010
Location: Gilmer, TX
Posted: 20th Dec 2010 16:03

Can someone tell me why this doesn't move the sprite along the X axis? it doesn't move the sprite at all actually, I've tried several ways to try to do this fumbeling with code and commands but this is the only logical-ish way I've figured to do it, can someone enlighten me?

Space for rent.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Dec 2010 17:07 Edited at: 20th Dec 2010 17:09
You are constantly re-setting it "IF backgroundX > 0"

Try it like this:


Oboro
14
Years of Service
User Offline
Joined: 27th Jul 2010
Location: Gilmer, TX
Posted: 21st Dec 2010 02:24 Edited at: 21st Dec 2010 02:34
I appreciate the quick response!
I was trying to add edges so that if you went too far you would hit the invisible wall, but I wanted to use the full size of the image as well not just the screen width...

Space for rent.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st Dec 2010 10:00
Quote: "I appreciate the quick response!"

No problem

Oboro
14
Years of Service
User Offline
Joined: 27th Jul 2010
Location: Gilmer, TX
Posted: 21st Dec 2010 15:15
Would the only method for this type of thing be to texture a plain? I think I remember seeing a thread for that sort of thing but I don't quite know how to do this with user controlled scrolling. I'm trying to make a rolling backdrop like the game Odin Sphere with multiple layers that scroll together at different intervals, i.e. foreground, middle-ground, and background all offsetted to simulate a painted 3D effect.. I wish there was a simple solution for this but there more than likely is not. any help or references anyone knows about this type of program would be appreciated!

Space for rent.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st Dec 2010 15:36
You can use 2D or 3D to achieve this. My current WIP (Ker-Bang) uses a background that scrolls at a different rate.

Here's a quick example. Use camX# and camY# as variables that store your current camera position and then position foreground and background sprites in a position proportional to that variable:



Just a quick example...

Oboro
14
Years of Service
User Offline
Joined: 27th Jul 2010
Location: Gilmer, TX
Posted: 22nd Dec 2010 14:31
Ok, so I've been working with the code that you gave me first and I think I've got a good base to work with, The only problem I'm having is getting the scrolling to stop at the edge of the image which is 10000 px long.. Here's my code I think I might have to do this with a collision system no?


Thank you so much for helping me, it means a lot baxslash!
I was pretty nervous that people would find me an annoyance and tell me that this was too difficult for my level of experience which may be true but I hope to learn a lot more by challenging myself with basic parts of systems and then trying to marry the code together using a flow chart.
Cheers!

Space for rent.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd Dec 2010 10:06
No problem. It might be too much to start with but who knows, and it's not like you're giving any attitude over the responses like some newcomers do.

Some people get frustrated and act like they know more than they actually do. That can annoy experienced users and put them off trying to help. I'd rather help someone like you who is maybe trying something too difficult but is grateful for the help!

You're wanting to stop at the end of your image so maybe you need to stop that distance minus your screen width:


Try that and see if it helps (check my comments)...

Oboro
14
Years of Service
User Offline
Joined: 27th Jul 2010
Location: Gilmer, TX
Posted: 23rd Dec 2010 14:49 Edited at: 27th Dec 2010 07:43
I never thought about it that way! Ok, I shall try this now, thanks again!

LMAO! it worked like a charm with exception of the

It needed to be minus because of the decreasing variable lol I plugged it in and set it a-rollin' with a print attached to the minx variable and had a wtf moment when it didn't work and realized that it was returning a negative number~


Space for rent.

Login to post a reply

Server time is: 2024-11-24 08:40:02
Your offset time is: 2024-11-24 08:40:02