Wave movement right to left - please help

Village IdiotVillage Idiot Member, PRO Posts: 486
edited August 2015 in Working with GS (Mac)

Hi.. I've been trying to make my actor randomly spawn from right to left and move in a random wave. I found this link "http://gamesalad.com/wiki/how_tos:gsc_wave_movement" on the forums but it doesn't work anymore. Can anyone please help me? I've seen references to this topic on the forums but was hoping for a tutorial if possible because I can't make it work with the references to things like change linear velocity etc unless it's within a context. What they discuss in this thread is what I'm trying to do: https://forums.gamesalad.com/discussion/11705/wave-movement-to-left

Comments

  • LovejoyLovejoy Member Posts: 2,078

    @Socks will probably come in here and recite you the alphabet. aaa bbb ccc

    Fortuna Infortuna Forti Una

  • SocksSocks London, UK.Member Posts: 12,822
    edited August 2015

    @Lovejoy said:
    Socks will probably come in here and recite you the alphabet. aaa bbb ccc

    Lol :smile:

    I've largely given up answering these kinds of questions, they tend to be a waste of everyone's time, rather than clearly stating the issue and (more often than not) quickly getting an answer, instead they tend to be protracted affairs. This criticism is not aimed at the OP here, it's a much more general comment aimed at the numerous questions where a poster provides only the very least amount of information or uses terms so vague as to initiate a 5 day guessing game lol : )

    So, for example, the goal here is to get an actor to 'randomly spawn' and move in a 'random wave'.

    Of course 'randomly spawn' and 'move in a random wave' could mean anything . . . . 'random' with regards to this 'random wave' could mean it is spawned at random (time) intervals (that's often my first guess), or each wave moves at random speeds, or they are spawned from random positions on the screen (again, this is often another good guess), or they are always spawned from the same X position but are spawned at random Y positions, maybe it's the height of the wave that is random or the pitch of the wave is random or maybe they are always spawned from the right hand side of the screen and move toward the left but a random angles . . . . and so on.

    The thing is with these kinds of question is that the OP will actually know the answer to these questions, they actually know what (for example) 'random wave' means, but people trying to help out are - for some odd reason - left to guess.

    Due to this approach there are so many threads that take this route . . . .

    A: Can anyone help me with a calculation, it's for a maths game ?

    B: Sure, how about 5 + 7 = 12 ?

    A: No, that's not the one I wanted.

    B: How about 100 + 16 = 116

    A: No, that's not it either, anyone else got any ideas ?

    C: Yeah, I've got one, 10 + 10 + 10 = 30

    A: No, it doesn't use any of those numbers.

    B: How about 100 + 10, that would come to 110, is it that ?

    A: No, I already said it doesn't use a 10

    B: Ok, how about 100 + 11 ?

    A: No, that's not it either . . .

    etc

    . . . when this would be soooooooooooo much easier . . .

    A: Can anyone help me with a calculation, it's 120 x 0.5 ?

    B: Sure, the answer is 60, x 0.5 basically means divide by 2.

    A: Thanks, I just got confused by the divide by a fraction thing !

    :tongue:

    But to be fair, this is my problem, I'm terrible at interpreting questions like this, others are much better, impressively so ! I'm often confused as to how they managed to work out exactly what the OP wanted !!

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    sigh

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    I'll try and be more specific. I've got these actors that I want to spawn from the right side of an iPad sized area in landscape format.

    I'd like them to appear at various heights from the right side and go across to the left in a wave like motion at random time intervals. I don't think I've got any particular angles in mind – I just thought it would be more interesting if the enemy actors would behave in this way rather than just come straight across (less predictable).

    I'm not sure about any of the numbers you mentioned, I'm happy to mess around with it once I get this going. I wish I could be more helpful, I really do put in a lot of time before I post any questions as I know it's annoying to you to see the same topics appear all of the time.

    I think that some of these more complex things though, aren't documented by GS and unfortunately don't seem to be covered in tutorials on YouTube etc. I have spent considerable time googling this and have not found anything that helps.

    It seems to me to be another one of these less than straight forward things to achieve. I would greatly appreciate any help with this as I just don't seem to be able to crack it. If there's anything else I can add to make it easier, please let me know.

  • SocksSocks London, UK.Member Posts: 12,822

    @monkeyboy simian said:
    sigh

    Lol, don't give up ! :smile:

    Orbz solution (the one you linked to) should work just fine, try it out.

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    my brain it hurtzzz

  • ArmellineArmelline Member, PRO Posts: 5,368
    edited August 2015

    It's pretty simple really. Here's a demo. I made it spawning on the left, but you can make it spawn on the right very easily by just moving the spawner and changing the direction the bubbles move. Make them more or less random, depending on what you want. The gif is very jerky, but that's only because I set the FPS so low. They're spawning at a set interval, but that's pretty easily changed and there are plenty of threads on how to do that.

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    You're a legend! Thanks.. I'll get stuck into it, though it's late here now. Good to see you out and about.. I'll let you know how I go if you like..

  • ArmellineArmelline Member, PRO Posts: 5,368

    Hope it helps! Always happy to hear how people get on!

  • SocksSocks London, UK.Member Posts: 12,822
    edited August 2015

    @monkeyboy simian said:
    iPad sized area in landscape format . . . various heights . . . random time intervals.

    This is the kind of information that is really useful, but simply cannot be guessed from 'move in a random wave' ! The more detail you can supply the easier it is for people to provide an answer - and you tend to get a good solution much much quicker ! :smile:

    @monkeyboy simian said:
    I'm not sure about any of the numbers you mentioned, I'm happy to mess around with it once I get this going.

    You've not addressed your post to anyone in particular - for example the reason I am reading this thread is only because @Lovejoy tagged my name (with @Socks), if you simply type a response there is no guarantee anyone is going to see it, I often miss posts responding to something I've said, only spotting them weeks later ! There are dozens of new threads posted each day, and hundreds of posts, posting a response to someone and hoping they revisit the same thread and spot your response means your post will occasionally get missed.

    'I'm not sure about any of the numbers you mentioned'

    The numbers I mention above, are just a silly made up example of the kind of question you often see on the forums.

    @monkeyboy simian said:
    I really do put in a lot of time before I post any questions . . .

    I wish people would put less effort in ! Lol, it's not so much a question of effort as one of focus, people (again, this is not directed at you) will spend ages filling in pointless details while at the same time not revealing much at all about the actual code they are asking people to help them with . . . so they will tell you that they have a brown teddy bear with a small red hat and moustache that walks along a platform and then gets into a lift, you then press a green button and the lift starts to move up, with the teddy bear inside, and then when you press the stop button a red light comes on and if the score is less than 100 when the red light is on then the lift stops, but the teddy bear keeps moving when it should be stopping . . . (etc etc) . . . when all you really want to know is: "I have an actor moving up the screen, using interpolate, and when an attribute changes, the actor should stop, but . . . " (etc)

    @monkeyboy simian said:
    . . . as I know it's annoying to you to see the same topics appear all of the time.

    I can only speak for myself, but I don't find that annoying at all, I'm happy to answer questions that have been asked many times before.

    @monkeyboy simian said:
    I think that some of these more complex things though, aren't documented by GS and unfortunately don't seem to be covered in tutorials on YouTube etc.

    Agreed, the best place for these kinds of things tends to be the forums.

    @monkeyboy simian said:
    It seems to me to be another one of these less than straight forward things to achieve. I would greatly appreciate any help with this as I just don't seem to be able to crack it. If there's anything else I can add to make it easier, please let me know.

    It's actually quite straightforward to do. Move your actor horizontally however you like (move, move to, change velocity - etc) but constrain its Y position to a sine wave.

    So for example:

    Constrain Y position to 100 *sin(self.time *200)+(whatever Y position you want).

  • SocksSocks London, UK.Member Posts: 12,822
    edited August 2015

    Example attached:

  • Village IdiotVillage Idiot Member, PRO Posts: 486
    edited August 2015

    @socks Thanks for the insight, I appreciate the time you've taken. It's strange but I think that the last paragraph helped me understand the concept a bit more. I think it's definitely left brain stuff going on here.. or is it right? I've got the brain that likes to scribble – though I am trying to beef up the other half.

    I'll be going back through this thread more closely when I next get some 'me time'. Though I don't know what D/P means..

  • ArmellineArmelline Member, PRO Posts: 5,368

    @monkeyboy simian said:
    I'll be going back through this thread more closely when I next get some 'me time'. Though I don't know what D/P means..

    It has a few meanings, but I'm pretty sure the one he intended was "double post".

  • SocksSocks London, UK.Member Posts: 12,822

    @monkeyboy simian said:
    It's strange but I think that the last paragraph helped me understand the concept a bit more.

    Good ! A sine wave is just one dimension of a point moving around a circle, imagine a dot moving around a clock, now imagine there is no left to right movement, it is just moving up and down from 6 to 12 (but at the speed it would take if it were going around a circle - so slower at the top and bottom), now take this up/down movement and move it horizontally and you will get a sine wave.

    @monkeyboy simian said:
    I think it's definitely left brain stuff going on here.. or is it right?

    Hemispheric dominance (the whole left-brained / right-brained people thing) is a myth.

    @monkeyboy simian said:
    I'll be going back through this thread more closely when I next get some 'me time'. Though I don't know what D/P means..

    It means 'double post', sometimes you can accidentally hit the 'Post Comment' button twice and post the same response twice !

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    oh.. thanks for the jargon translation @Armelline.. l've never been good at keeping up with all of these terms. @Socks – thanks for the upload.. between you and @Armelline, surely I'll get this.. all appendages are crossed. I'll have to resume my quest later. It's midnight here and I must have my beauty sleep so that I can leap into tomorrow full of hope and determination.. or something like that..

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    @Socks @Armelline: Just having a quick look at your two different files I can't help but think that there are various ways to do things.. curiouser and curiouser..

  • ArmellineArmelline Member, PRO Posts: 5,368

    We use the exact same method. I just order things a little differently and added some randomisation.

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    @Socks.. I don't understand how you can have game.X seconds in the timer? Could you please explain?

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    @Armelline God I hope that this gets easier for me to understand. I feel like I'm running around in a foggy forest.

  • ArmellineArmelline Member, PRO Posts: 5,368

    Check this brief video I made a while back for a short overview regarding what's happening in our examples:

  • SocksSocks London, UK.Member Posts: 12,822
    edited August 2015

    @monkeyboy simian said:
    Socks Armelline: Just having a quick look at your two different files I can't help but think that there are various ways to do things.. curiouser and curiouser..

    Yep ! Absolutely, there are numerous ways of doing things in GameSalad which neatly takes us back to the earlier point, if someone says 'I have an actor moving upwards but the problem is . . . blah blah blah . . . ' it doesn't really tell us anything as there are lots of ways someone could get an actor to move upwards, that's why it's much more useful if someone says 'I am moving an actor up the screen (iPad landscape) using a change attribute behaviour to change the Y linear velocity to 140, but the the problem is . . . blah blah blah . . . '.

    I bet if you were to ask ten people to make a simple mechanic in GameSalad, let's say an actor moving in a square path around the edge of the screen, it's unlikely you find two people who've used the exact same method.

  • SocksSocks London, UK.Member Posts: 12,822

    @monkeyboy simian said:
    Socks.. I don't understand how you can have game.X seconds in the timer? Could you please explain?

    Sure, game.X is an attribute, if you follow the logic through, from top to bottom it should make sense . . . .

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    @Socks @Armelline .. Just thought I'd let you guys know that I've got it working. And thanks again. I'll have to tweak it to make it the speed etc that works best for the game. I was wondering though – Does GS understand it when you make attributes and name them things like Wave Speed, Wave Height and Starting Y as in your example Armelline? Are they specific names to be used in GS? Or are they a known math thing?

  • SocksSocks London, UK.Member Posts: 12,822

    @monkeyboy simian said:
    Socks Armelline .. Just thought I'd let you guys know that I've got it working.

    Good stuff ! :smile:

    @monkeyboy simian said:
    I was wondering though – Does GS understand it when you make attributes and name them things like Wave Speed, Wave Height and Starting Y as in your example Armelline? Are they specific names to be used in GS? Or are they a known math thing?

    Attribute names are just for you the user, you can call an attribute whatever you like.

  • ArmellineArmelline Member, PRO Posts: 5,368

    @monkeyboy simian said:
    Does GS understand it when you make attributes and name them things like Wave Speed, Wave Height and Starting Y as in your example Armelline? Are they specific names to be used in GS? Or are they a known math thing?

    I just picked names that were as descriptive as possible so you'd know what each attribute did.

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    @Socks @Armelline I thought that the naming might be arbitrary. I'm having a conceptual problem understanding how GS knows what these things are referring to though. Is GS being told what to do in this particular Constrain Attribute? See attached grab:

    And then applying whatever instructions to that because it's got the sin stuff.. the maths?

  • SocksSocks London, UK.Member Posts: 12,822

    @monkeyboy simian said:
    Is GS being told what to do in this particular Constrain Attribute?

    Yes, GS is being told to constrain the attribute in the first box to the value in the second box.

    @monkeyboy simian said:
    And then applying whatever instructions to that because it's got the sin stuff.. the maths?

    I'm not sure what this means, does 'that' in this context mean the actor ?

  • SocksSocks London, UK.Member Posts: 12,822

    @monkeyboy simian said:
    Socks Armelline I thought that the naming might be arbitrary.

    You can test these sorts of things fairly easily, just rename the attributes to something else and see if it effects the end result.

  • ArmellineArmelline Member, PRO Posts: 5,368

    @monkeyboy simian said:
    Is GS being told what to do in this particular Constrain Attribute?

    Yes.

    We've shown you how to make an actor move in a wave, with adjustable position, speed and wave height. Experiment with those three things to get the result you're after.

Sign In or Register to comment.