Stopping an actor

124»

Comments

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

    @tatiang said:
    Best thread ever. Socks spins his magic again. ;)

    Lol

    @diegolaya_ said:
    Hahaha you both did!

    This is the part where diegolaya adds "Oh yeah, I also need everything to rapidly spin counterclockwise . . ."

    :tongue:

  • diegolaya_diegolaya_ Member Posts: 69

    @Socks Hahaha :D :D Actually theres still a lot of project to work on so you will problably see me later on ;)

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

    @diegolaya_ said:
    Socks Hahaha :D :D Actually theres still a lot of project to work on so you will problably see me later on ;)

    [runs away and hides in a secret underground vault]

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited February 2015

    The combination to that vault is AAA * sin(self.time * BBB)+CCC.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • diegolaya_diegolaya_ Member Posts: 69

    @Socks said:
    [runs away and hides in a secret underground vault]

    Is it too early for you to get out of the secret underground vault? :s Man... I've been trying to figure this out, but I need a little help, I really hope you dont think Im dumb, its just that I'm experiencing with game salad, and this is the way that has thaught me the best.. I need to make the enemies (same size as the main character, the square) fall down faster than the grid, also, it has to be many, BUT there always has to be a space or two or three (it doesnt matter) for the square to pass throgh, they have to push the square down, AND they have to be vertically aligned with the vertical lines of the grid (I dont want them to spawn in the middle of a line as it would look ugly and you know... It would mess up things) Sorry for the inconvenience, but this is a really difficult one and I need help from a specialist but I cant find a tutorial for this... Any ideas, clues, advices?

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

    @diegolaya_ said:

    I need to make the enemies (same size as the main character, the square) fall down faster than the grid

    The grid is static.

    also, it has to be many

    Yoda ?

    AND they have to be vertically aligned with the vertical lines of the grid

    I'm going to guess you mean horizontally aligned (?), if that's the case the just use some simple maths to quantise their positions.

    So if you want to quantise something to 10s for instance:

    positionX = floor(positionX /10)*10

  • diegolaya_diegolaya_ Member Posts: 69

    @Socks horizontally aligned sorry, and yeah the grid is static but imagine it is falling down... What do I have to do with positionX = floor(positionX /10)*10? Is that an attribute or a change attribute? And thats for the alignment, what about the spawn? :)

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited February 2015

    That expression simply snaps an actor to a grid position. Imagine that X=100. floor(100/10) * 10=100. So not much changes. But if X=102, floor(102/10) * 10=100 so it forces the X value to be 100. You can use this with Change Attribute or Constrain Attribute behaviors. You might want to use round(positionX/10) * 10 instead because a value close to another grid point, such as 109, will snap to 100 using floor but to 110 using round.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • diegolaya_diegolaya_ Member Posts: 69

    @tatiang said:
    That expression simply snaps an actor to a grid position. Imagine that X=100. floor(100/10) * 10=100. So not much changes. But if X=102, floor(102/10) * 10=100 so it forces the X value to be 100. You can use this with Change Attribute or Constrain Attribute behaviors. You might want to use round(positionX/10) * 10 instead because a value close to another grid point, such as 109, will snap to 100 using floor but to 110 using round.

    Got it.. How can I set the random function instead of being with every number like 1-4 (1,2,3,4) to choose from numbers I give? Like 80-100 I dont want it to be 80,81,82...98,99,100 but only 80 or 100

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

    @tatiang said:
    You might want to use round(positionX/10) * 10 instead because . . .

    Good point !

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @diegolaya_ said:
    Got it.. How can I set the random function instead of being with every number like 1-4 (1,2,3,4) to choose from numbers I give? Like 80-100 I dont want it to be 80,81,82...98,99,100 but only 80 or 100

    It's not a random number. It's a value you decide on based on the grid size. If your grid size is 20 pixels, then you use 20 in place of the 10 in that expression:

    round(positionX/20) * 20

    That will snap to X=0, 20, 40, 60, 80, 100, etc.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • diegolaya_diegolaya_ Member Posts: 69

    @tatiang That expression snaps the enemy to the grid, but the thing is that I dont want it to go as fast as the grid, I want it to be faster.. And I need many of them randomly positioned (In x positions 20,60,100,140,180,220,260 or 300) Thats why I asked you the random function thing

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I don't think I understand but if you want to generate a random number that is a multiple of 40 minus 20 as you've shown above then the expression would be random(minimum multiple of 40, maximum multiple of 40) * 40 - 20. For example, to create values in the set {20, 60, 100, 140} you would use random(1,4) * 40 - 20. Expressions can be used in all sorts of behaviors including Change Attribute, Constrain Attribute, Spawn Actor, MoveTo, etc.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • diegolaya_diegolaya_ Member Posts: 69

    @tatiang said:
    I don't think I understand but if you want to generate a random number that is a multiple of 40 minus 20 as you've shown above then the expression would be random(minimum multiple of 40, maximum multiple of 40) * 40 - 20. For example, to create values in the set {20, 60, 100, 140} you would use random(1,4) * 40 - 20. Expressions can be used in all sorts of behaviors including Change Attribute, Constrain Attribute, Spawn Actor, MoveTo, etc.

    I asked that because: The expression socks gave me was for aligning the actor with the grid, but he didnt tell me about spawning o replicating that actor several times in different positions.. So I thought about setting a timer that every random (1,5) seconds spawn actor in X= 20,60,100,140,180,220,260 or 300 and Y=500 (The scene is 320x480) and then Move in direction 270 but I dont think it would work

  • diegolaya_diegolaya_ Member Posts: 69

    @tatiang @socks ↑↑↑↑↑

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

    @diegolaya_ said:
    tatiang socks ↑↑↑↑↑

    Do you have a question ?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited February 2015

    @diegolaya_ said:
    So I thought about setting a timer that every random (1,5) seconds spawn actor in X= 20,60,100,140,180,220,260 or 300 and Y=500 (The scene is 320x480) and then Move in direction 270 but I dont think it would work

    Have you tried it? Keep in mind that Every timers cannot be used with random values or attribute values that change. The timer will calculate the initial value and then keep that value. Instead, you'll need a custom interval timer: http://forums.gamesalad.com/discussion/comment/464547/#Comment_464547.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • diegolaya_diegolaya_ Member Posts: 69

    @tatiang said:
    Have you tried it? Keep in mind that Every timers cannot be used with random values or attribute values that change. The timer will calculate the initial value and then keep that value. Instead, you'll need a custom interval timer: http://forums.gamesalad.com/discussion/comment/464547/#Comment_464547.

    Ok... But the timer isnt the most important thing, as it is spawning the actor in those coordinates I told you that I dont know how to set

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    If you want to spawn an actor at random positions that are multiples of a certain number, you'd use the expression I posted earlier:

    For example, to create values in the set {20, 60, 100, 140} you would use random(1,4) * 40 - 20.

    If you want the X position of the actor to be 20, 60, 100, or 140, you would put random(1,4) * 40 -20 inside the expression for the x position (the first box of the "from position") of the Spawn Actor behavior.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • diegolaya_diegolaya_ Member Posts: 69

    @tatiang said:
    If you want to spawn an actor at random positions that are multiples of a certain number, you'd use the expression I posted earlier:

    If you want the X position of the actor to be 20, 60, 100, or 140, you would put random(1,4) * 40 -20 inside the expression for the x position (the first box of the "from position") of the Spawn Actor behavior.

    So If I want it 20,60,100,140,180,220,260,300 it would be random(1,8)*40-20

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited February 2015

    @diegolaya_ said:
    So If I want it 20,60,100,140,180,220,260,300 it would be random(1,8)*40-20

    Yes. If you try substituting the values of the random function in that expression, you'll see this:

    1 * 40-20=20
    2 * 40-20=60
    3 * 40-20=100
    ...
    7 * 40-20=260
    8 * 40-20=300

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

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

    @diegolaya_ said:
    So If I want it 20,60,100,140,180,220,260,300 it would be random(1,8)*40-20

    You know you can test all this stuff in GameSalad !?

    It seems weird to have to ask a question like this, why not type these values into GameSalad rather than typing them into the forum ? :)

  • diegolaya_diegolaya_ Member Posts: 69

    @Socks On January 30 you told me ''Also you were right to type out a question rather than to simply test this yourself, I recommend this is always the first step, never assume anything is going to work'' so that was kind of rude from you...

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

    @diegolaya_ said:
    Also you were right to type out a question rather than to simply test this yourself, I recommend this is always the first step, never assume anything is going to work

    It was a joke, I wasn't being serious !! I think it's ridiculous when people ask questions where it would take longer to type a post than it would to simply check it out for yourself in GameSalad.

    That's how you learn GameSalad, use it !

    Why type "So If I want it 20,60,100,140,180,220,260,300 it would be random(1,8)*4020" . . . and then wait for someone to tell you whether this is right or not, when you can type random(1,8)*40-20 into GameSalad and check it out for yourself ?

    Or as it has been put elsewhere.

    "hey, anyone know if I can type the word 'coconut' in all capital letters on the forum, you know, like 'BASKET' or 'ONION' or 'CHICKEN', but using the word 'coconut' instead ?"

    :p Apologies if you were offend by my humour, it was just a bit of fun.

  • diegolaya_diegolaya_ Member Posts: 69

    @Socks Well it didn't look like a joke so dont blame me if I take it seriously.. Dont worry.. Perhaps, I'm limitated because of the fact that you made the most important thing in my project, and its not that I ask before doing something, I try the things I think would work, 3, 4, 5 different things and then I come here, but I prefer waiting for a response than doing things that will screw up my project like it happened yesterday

  • colandercolander Member Posts: 1,610
    edited February 2015

    @diegolaya_ said: I try the things I think would work, 3, 4, 5 different things and then I come here, but I prefer waiting for a response than doing things that will screw up my project like it happened yesterday

    This doesn't prevent you from testing just create a new version of your project to test. That way if something goes wrong you can bin it. Also you should be regularly save new versions of your project, like at least every hour. GS is notorious for corrupting projects, saving new versions and doing it often is highly recommended.

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

    @diegolaya_ said:
    Socks Well it didn't look like a joke so dont blame me if I take it seriously..

    No, that's right it didn't look like a joke, it starts with the word 'Seriously !' And 'Lol !' and includes a couple of those well known indicators of seriousness, the smiley :smile: :wink:

    Strangely you even responded with a post that strongly suggests that you recognised the humour, you even threw in a smiley :smile: of your own.

    @diegolaya_ said:
    its not that I ask before doing something, I try the things I think would work, 3, 4, 5 different things and then I come here,

    Oh, so that advice you said you took seriously and admonished me for . . . you didn't actually follow !? I wonder what I was being told off for then ?

    This is all too confusing for me, I'm off to play Crossy Road.

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

    @colander said:
    This doesn't prevent you from testing just create a new version of your project to test.

    Yep, in fact you don't even need the project.

    New project > new actor > Disiplay text behaviour > type: random(1,8)*40-20

  • diegolaya_diegolaya_ Member Posts: 69

    @colander said:
    This doesn't prevent you from testing just create a new version of your project to test. That way if something goes wrong you can bin it. Also you should be regularly save new versions of your project, like at least every hour. GS is notorious for corrupting projects, saving new versions and doing it often is highly recommended.

    From now on Ill be doing that, thank you

  • diegolaya_diegolaya_ Member Posts: 69

    @socks didnt really understand what you meant with "Oh, so that advice you said you took seriously and admonished me for . . . you didn't actually follow !? I wonder what I was being told off for then ?" but it doesnt really matter.. We dont need to discuss over dumb things, we have important things to do so lets forget that and move on :/ :s

Sign In or Register to comment.