The Daily Click ::. Forums ::. Klik Coding Help ::. Continuous scrolling bg
 

Post Reply  Post Oekaki 
 

Posted By Message

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
5th August, 2013 at 05/08/2013 15:26:16 -

So embarrassed to be asking this, as this was one of the first things I did when I started using TGF about 14 years ago...

I've given my background object constant movement to the left (via bouncing ball). Then I have this event:

X Position of "background">=VirtualWidth-0
Create "background" at (539,0) from "background"

That works, but it sends my object limit to the max. I would have thought it'd create a horrible messy background as it's like it's constantly setting it, but it actually displays perfectly. Here is an example:



But I can't do it this way, as like I said, there are about 500 instances of it in the frame which is not right.

Anyway, I hope I've explained what I'm trying to do. I'm probably going about it in the wrong way, does anyone know how I need to set the event up?

Edited by -Liam-

 
Image

Tell 'em Babs is 'ere...

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
5th August, 2013 at 05/08/2013 19:05:11 -

This can be fixed using the Active Picture object.

Use the Horizontal Offset option to set the position of your background.

If you need an example let me know

 
n/a

nim



Registered
  17/05/2002
Points
  7234
5th August, 2013 at 05/08/2013 23:32:27 -


Originally Posted by -Liam-
X Position of "background">=VirtualWidth-0
Create "background" at (539,0) from "background"



I think it's probably creating the multiple objects in the same place (i.e. on top of each other) but you only see the foremost one which is why you don't notice it.

 
//

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
5th August, 2013 at 05/08/2013 23:56:20 -

Thanks guys,

I've just tried the Active Picture object with a Always Offset Horizontally -1 but it's as if it just offsets it once, not continuously pushing it off screen. I'd love a little more detail on this if possible. Also how would I get it to wrap over the screen again and again?

 
Image

Tell 'em Babs is 'ere...

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
6th August, 2013 at 06/08/2013 01:45:11 -

Hopefully this will help

Press the left and right arrow keys to scroll the image

http://www63.zippyshare.com/v/65251672/file.html

 
n/a

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
6th August, 2013 at 06/08/2013 10:04:01 -

lembi, thank you so much! I was so close the first time..! I spent hours messing around with this yesterday but now it's been done in about 1 minute! Great! n_n

Edit: Question. Do the Active Pictures have to be stored externally? I ask because I'm hoping to do this on iOS, hopefully it can be stored in the resources folder, but I'd feel better if the image was embedded in the application if possible.

Edited by -Liam-

 
Image

Tell 'em Babs is 'ere...

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
6th August, 2013 at 06/08/2013 11:10:13 -

In all honesty I don't know. You could probably store it in the binary resources folder yeah.

 
n/a

Pan-tosser



Registered
  24/10/2008
Points
  520

Has Donated, Thank You!
7th August, 2013 at 07/08/2013 00:27:22 -

here is a link to an example of how I would do it. but it depends on the project. but I like to move a complete layer. That way enemies on that layer don't have to track the moving object they are standing on.

my example is kind of lazy, but you should still see what's happening with it.

https://docs.google.com/file/d/0B7keH3r76K8Id01DQkF1TjEwNDg/edit?usp=sharing

 
https://www.facebook.com/nathon.brown.7

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
7th August, 2013 at 07/08/2013 01:49:47 -

This results in a very jerky scrolling though. Compare the 2 engines and you will see the difference.

Your engine simply repositions the image once it reaches a predetermined location.

My engine scrolls the image and wraps it smoothly. This way you don't notice the join in the image (assuming your background is wrappable). You are also able to make it move in conjunction with your player speed/position too.

 
n/a

Pan-tosser



Registered
  24/10/2008
Points
  520

Has Donated, Thank You!
7th August, 2013 at 07/08/2013 15:17:45 -

-@ lembi I love your engine it is good. its a lot like the quasi-infinite capabilities that media fusion has built in.

here is a example of that. I only share it to add another option to the pot.

-I know my first example was a half ass effort. but the method is solid. it can easily be changed to move smoothly. by chaining three layers together that fallow each other.

-but it all depends on the project one is making. I like the active picture though. it's a lot better than active background. which cant fallow the frame.

https://docs.google.com/file/d/0B7keH3r76K8IZHBjOENKcEFQNTA/edit?usp=sharing

 
https://www.facebook.com/nathon.brown.7

Jenswa

Possibly Insane

Registered
  26/08/2002
Points
  2723
8th August, 2013 at 08/08/2013 16:21:49 -

Not sure if it helps any,

but in your first post and that line of code, add: "Run this event only once" so it won't create that many objects in the same spot.

However when reading your entire post I am not sure if this was what you were looking for.

Perhaps you can put your backing into an active object and move that one?

Happy coding!


 
Image jenswa.neocities.org

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
8th August, 2013 at 08/08/2013 23:14:16 -

...I don't know about you guys, but you can adjust the properties of layers to accommodate this effect.

I use a basic Backdrop Object. Send it to its own layer. Select the layer (if you don't see layers by default, press CTRL+K). You can adjust the offset on the properties window, as well as check-off boxes for vertical and horizontal scrolling.

I've been focusing on Flash applications lately, which don't allow Active Pictures. But normal Backdrop Objects in an offset frame configured thusly seem to work fine, no Conditions or Events needed.

What am I missing? Are there no layers permitted in the iOS exporter or something?

...Sorry if I'm missing something blatantly obvious, folks.

 
n/a

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
9th August, 2013 at 09/08/2013 00:10:26 -

DUH!!!

Never even thought about the layers option and changing the scroll offset... Even less memory consumed by the application this way (i think).

Liam, if you can, go with this method.

Thanks for reminding me about this smr!!!

 
n/a

Pan-tosser



Registered
  24/10/2008
Points
  520

Has Donated, Thank You!
9th August, 2013 at 09/08/2013 00:50:34 -

-i still don't think that will work for liam's project. because it still requires keyboard input for it to scroll.

if you look at the video the character runs on screen and then stops and idles. With just the layers set the wrapping. Wrapping wouldn't trigger in tell the player advanced forward.

The only thing i could come up with to solve that. Is to make an active object with ball movement invisible. Then set the ball moving off to the right with the scrolling centered in it.

This forced the wrapping settings in the layers to trigger as the ball moved threw the virtual coordinates of the level.

-I'm still not happy with this method though. I feel a constant scrolling might be hard to program around. but i could post way i did if their is any interest in it. Maybe someone one on here could improve on it.




 
https://www.facebook.com/nathon.brown.7

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
9th August, 2013 at 09/08/2013 11:09:44 -

Thanks for all the replies, guys.

My first thought was to use the layers. But as pan-tosser said, the scrolling stops when the character is not moving. This level is like your average scrolling platform game such as Super Mario Bros, only it takes place on a moving train, so the background needs to continuously move. I couldn't figure out a way to do this by adjusting scrolling properties on a layer.

Jenswa, I tried the "Run the event only once" and "Only one action when event loops" but this only makes the background scroll once, then it's gone.

I think I finally got the Active Picture to work. If I'm right, you don't change the directory in mmf, you simply import the files to Xcode and it somehow, manages to find them... I guess that's good!

Edited by -Liam-

 
Image

Tell 'em Babs is 'ere...
   

Post Reply



 



Advertisement

Worth A Click