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?
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.
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?
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.
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.
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.
-@ 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.
...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.
-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.
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!