Problem creating a "Wrap" With Interpolate - a HArd One, Gurus please come!

MagoNicolasMagoNicolas Member, PRO Posts: 2,090
edited November -1 in Working with GS (Mac)
Hello Guys, how are you?
I created a Wrap (Like Wrap function of Gamesalad, that if you go to the right… you will appear in the left..) With Interpolate.

I have 2 images, that need to move aligned and Wrap.

My rules (Of both objects) are like this:

If Position Different to 0
Interpolate to 0 at a Constant Speed.
Otherwise (If Position is equal to 0)
Change Position to Other Object + size With of that object

This would make it warp, if the object is moving from right to LEft.

But.. Once in like 20 - 30 games… The thing don't work, and they both stay in the same places, and and Wrap from half of the screen

Please help if you figure out a better method!

Thanks

Comments

  • RedlerTechRedlerTech Member Posts: 1,583
    is there a reason why you cannot rap a scene?
  • MagoNicolasMagoNicolas Member, PRO Posts: 2,090
    Yep, Because I will need to Make the Actor movable, and that will screw Performance.

    Or maybe I can figure it out with interpolate, have to think more on it.
  • RedlerTechRedlerTech Member Posts: 1,583
    alright, do you mind posting a video?

    Matt
  • MagoNicolasMagoNicolas Member, PRO Posts: 2,090
    Here is a video of what I have,

    Sometimes it Leaves a Little Space in the Middle.

    but some Rare times, it doesn't work.

  • RedlerTechRedlerTech Member Posts: 1,583
    So basically, you don't wrap for performance issues & you just interpolate very quickly?

    Matt
  • MagoNicolasMagoNicolas Member, PRO Posts: 2,090
    Yep, I Dont Warp for Performance Issue, And interpolate the stuff to move constantly, and when it arrives to 0 goes to the Right.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    have less then or equal to zero instead of just equal zero in the rule
  • MagoNicolasMagoNicolas Member, PRO Posts: 2,090
    You Mean Less than AND Equal?

    If it was that, didn't work :(
  • RedlerTechRedlerTech Member Posts: 1,583
    try both, all or any
  • MagoNicolasMagoNicolas Member, PRO Posts: 2,090
    Not working, It Does works perfect (My Old Method) at a Lower Speed. But with higher ones doesn't :(
  • RedlerTechRedlerTech Member Posts: 1,583
    At this point, at this time, at my level of sleep... I'm really not sure :/

    Sorry,
    Matt
  • MagoNicolasMagoNicolas Member, PRO Posts: 2,090
    Lol, Will go 2 Sleep now to, Hope that the solutions appear Magically!

    Cheers and thanks for your help.
  • SparkyidrSparkyidr Member Posts: 2,033
    Nicolas.

    you 2 actors instead of 1

    then instead of interpolating back to your 0 point on the right, interpolate back to the 0 point + 1/2 the width of actor 2.

    i.e. when actor 1 goes offscreen, actor 2 will be onscreen, and interpolate actor 1 to behind actor 2. This should loop much nicer....if you get what I mean.
  • MagoNicolasMagoNicolas Member, PRO Posts: 2,090
    Sparkyidr said:
    Nicolas.

    you 2 actors instead of 1

    then instead of interpolating back to your 0 point on the right, interpolate back to the 0 point + 1/2 the width of actor 2.

    i.e. when actor 1 goes offscreen, actor 2 will be onscreen, and interpolate actor 1 to behind actor 2. This should loop much nicer....if you get what I mean.

    I get it, will make a test!
    Thanks.

    Btw, I have 2 actors, but both going to 0.
  • MagoNicolasMagoNicolas Member, PRO Posts: 2,090
    Omg, Cant Solve this yet :(
  • SparkyidrSparkyidr Member Posts: 2,033
    just about to email you a project which might help dude.
  • MagoNicolasMagoNicolas Member, PRO Posts: 2,090
    Sparkyidr said:
    just about to email you a project which might help dude.

    Thanks Dude!! Hope it works :D
  • SparkyidrSparkyidr Member Posts: 2,033
    all you need to do in that project (scene 2 btw) is replace how I am doing the motion (with velocity) with your way (using interpolates?)

    the code for the wrapping should work in theory....
  • DizkoDizko Member Posts: 498
    Make the rule to just less than instead of equal to. So whenever the value goes below zero, it triggers.

    The thing with interpolate is just that, it interpolates. It does a lot of guessing and isn't precise. It might be that it's skipping the value you have the trigger set at, so make it so that it triggers on anything past that value.
  • SparkyidrSparkyidr Member Posts: 2,033
    yeah, when I am doing the scrolling like that, I ALWAYS set it to lessthan or equal to.

    "=" alone doesn't work over 1/2 the time in my experience.
  • MagoNicolasMagoNicolas Member, PRO Posts: 2,090
    Thanks, That is off course An Issue, now I change it to less than or equal to.

    At High Speed dosnt work perfect.

    Now I will test it on the MAx Speed I will use in my game (Is Less thatn the high speed I test in GamesAlad and make me have problems), and see if sometimes I have problems or not.

    Cheers.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi MagoNicolas, here's two other methods you could try, neither using Interpolate.

    This first one uses 1 background and spawning/destroying with Move.

    In the background on screen put:

    Move attribute Dir. 180

    Rule
    When attribute self.Position.X <240

    Spawn Actor
    Position self.Position.X + 480

    Rule: when self.position.X < -241
    Destroy this actor

    The second one, uses Move as well. Use 2 background frames, the edge of the first one in the middle of the screen, the second next to it.

    Move attribute Direction 180

    When self.Position.X = 240
    change attribute self.Position.X = 719

    Put this in both of the actors' Rules.

    A third thing to consider is using your Ruling but instead of Interpolate, try using a negative number with linear velocity.

    Hope that helps.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • AppsRacKAppsRacK Member Posts: 346
    tried this one before and manage to interpolate the background scene by aligning 3 the same images but i cant solve the gap problem between some of the images. There seems to be a lag and delays when using interpolate so you will see a gap between images.

    The only way i could think of is accessing the scene.layers and comparing the self.x position of each image and using it as a rule.

    ex:
    if image1.position.x = 240; <--(half of screen)
    --->interpolate image2 to -240; <--image 2 x position is at 720

    if image2.position.x = 240; <--(half of screen)
    --->interpolate image3 to -240; <--image 3 x position is at 720

    if image3.position.x = 240; <--(half of screen)
    --->interpolate image1 to -240; <--image 1 x position is at 720

    relocate images when outside screen

    if image1.position.x = -240;
    -->change attribute position.x = 720;
    then do the same with image2 & image3.

    -drahc
  • MagoNicolasMagoNicolas Member, PRO Posts: 2,090
    drahc said:
    tried this one before and manage to interpolate the background scene by aligning 3 the same images but i cant solve the gap problem between some of the images. There seems to be a lag and delays when using interpolate so you will see a gap between images.

    The only way i could think of is accessing the scene.layers and comparing the self.x position of each image and using it as a rule.

    ex:
    if image1.position.x = 240; <--(half of screen)
    --->interpolate image2 to -240; <--image 2 x position is at 720

    if image2.position.x = 240; <--(half of screen)
    --->interpolate image3 to -240; <--image 3 x position is at 720

    if image3.position.x = 240; <--(half of screen)
    --->interpolate image1 to -240; <--image 1 x position is at 720

    relocate images when outside screen

    if image1.position.x = -240;
    -->change attribute position.x = 720;
    then do the same with image2 & image3.

    -drahc

    Yep, its seems that there is a Lag Issue

    Im doing with the method you say.

    It works fine at small speeds, I change a little my game speed and will test if now there is non problem.

    Thanks to all, gyro, I want to do it with interpolate.

    Cheers
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    MagoNicolas said:

    Thanks to all, gyro, I want to do it with interpolate.

    Cheers

    ah, OK, sorry I couldn't help. For interest, can I ask why you want Interpolate and not Move?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MagoNicolasMagoNicolas Member, PRO Posts: 2,090
    SOLVED

    It was BEcause of performance, thanks for your help.

    NOw I Make it Move… and didn't affect performance.
    I have 6 actors that make this:

    They Warp in x, and they only have one rule:
    Change: Self.motion, linear velocoity X to -GameSpeed/One number..

    And it works great, and again, didn't affect performance at all.

    Lol people talk to much about non movable actors and interpolate that I was a little Maniac..

    Cheers.
  • RHRH Member Posts: 1,079
    Does wrapping a scene really affect performance? That's a bummer for my game if it does...
  • MagoNicolasMagoNicolas Member, PRO Posts: 2,090
    RH said:
    Does wrapping a scene really affect performance? That's a bummer for my game if it does...

    For me, didn't affect,
  • AppsRacKAppsRacK Member Posts: 346
    @RH
    It wont effect much if you have only have a few movable actors.

    @Mago
    I ended up using wrapX as well as i noticed that i dont have much gain using interpolate and i dont want to gamble having a gap between images. So far still stable at 60fps with 3-4 256x1024 movable actors.
Sign In or Register to comment.