Trajectory path and rule when angle changes

themagicboxthemagicbox Member, PRO Posts: 82
edited May 2013 in Working with GS (Mac)
So I have a zapper thing where the angle can be adjusted to shoot something...I want to trigger an action everytime the angle changes, and use that angle for a rule...when the game first starts, it will already be point at 90 degrees..and the action would happen for 90 degrees...when the player changes the angle to maybe 60, it will fire the same action as before but for 60 degrees, it will also stop the previous action if it is still going on...the action doesn't last that long but if someone were to swipe through the angles, they should see the beginnings of all the actions each angle they swipe through...I hope my explanation makes sense lol

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    The easy way is to change the actor's image based on the self.rotation (When self.rotation≤90 AND self.rotation>60...) Each image would show a silhouette or partial image of an action, something like that.

    The hard way is to use that same rule but then have a custom animation that can be stopped if the rule is no longer true. I'm not going to explain that here because I really don't have any experience with it. But you can search for it.

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

  • themagicboxthemagicbox Member, PRO Posts: 82
    I think you may have understood what I wanted to do :S///sorry my explanation is not good...

    this is going to link to another post I have to make haha but pretty much the action I want to "contrain" to the angle is a trajectory path...for the "path" I am recording the positions of a shot bullet from the zapper (an invisible actor will shoot when game starts and whenever the angle changes) to create a trail. I would like to trigger that invisible actor to shoot whenever the angle changes :) hopefully that makes more sense
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Hmm, still not quite getting it. Perhaps you can provide a sketch?

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

  • themagicboxthemagicbox Member, PRO Posts: 82
    So I've been trying to combine these two techniques I found in the forums with no success...

    http://www.youtube.com/watch?feature=player_embedded&v=SsYsPbUF6Dk

    the above is a video for how to create a stream of dots that show the path of a shot actor.

    What I would like to do in have the dots fill up faster that the timers in game salad can go. The shot actor will be moving faster than the demo in the above video and the dots are too far apart when I test it out. I noticed there is some point around 0.02 where the timer just doesn't go any faster when I was trying out a faster times

    I found stuff one fast loops and I figured this may be what I need. But after trying to put it in my game but I can't seem to have it loop properly. The number of dots that show when the actor is shot decreases as I copy more copies of my rule...

    Is there any easier way to have loops faster than the timers?
  • themagicboxthemagicbox Member, PRO Posts: 82
    sorry should have posted this first
    http://forums.gamesalad.com/discussion/56871/fast-loops-and-trajectory-path#latest

    that's what I want to happen when an angle is chosen (an actor is fired and a trail is created)

    so there is a pointer on a half circle protractor thing to choose an angle by dragging touch...everytime the pointer is moved to a new angle, an actor is fired
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited May 2013
    [merged the two threads]

    Is this fast enough? I made the trail actor smaller than in the attached file for this screenshot. The change velocity behavior was set to 1500 speed.

    image

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

  • themagicboxthemagicbox Member, PRO Posts: 82
    wow that's fast! I just took a quick look and I noticed that your are spawning actors...I initially was doing my game recycling the dots like in the tutorial...would that be possible or would it be easier to just spawn the dots
  • themagicboxthemagicbox Member, PRO Posts: 82
    oh I just noticed the screen shot..i tested it at 1500 and the dots are closer together (which is a good sign don get me wrong)...but is that a test on the ipad? will the spaces be different depending on the device because of the processing? I was looking at a velocity of around 5000
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    The scene size is for iPad but I only tested it in Creator. 5000 is pretty darn fast. I don't think the "oldTime" loop I used will suit you. You'd need a faster loop, which others here have created (search hyper loop, for example).

    Out of curiosity, why are you using 5000? Is the camera following the projectile?

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

  • themagicboxthemagicbox Member, PRO Posts: 82
    edited May 2013
    its just supposed to show a trail of where the bullet will be shot so the player knows where its going to go while taking into account what it will hit before they actually shoot

    its looks like its working at 5000...the dots are just a little further apart..but I have no idea it its already past some threshold..im curious why in your screenshot it looks different than when I test it on my computer at 1500

    Ill try looking at the hyper loops again but I cant understand how to work it...im still trying to see if I used the faster loop method right as well because I may be putting it in wrong..
  • themagicboxthemagicbox Member, PRO Posts: 82
    I also think 5000 might be a little overkill so I might reduce it to 2500...I just don't want the player waiting too long to see where the ball might go at each angle change
  • themagicboxthemagicbox Member, PRO Posts: 82
    edited May 2013
    oh and no there is no camera following.... the bullet is just bouncing around
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited May 2013
    If you haven't seen @ORBZ trajectory demo, you might save yourself a lot of trouble. I'm going to sleep but I'll check this thread tomorrow. I-)

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

  • themagicboxthemagicbox Member, PRO Posts: 82
    edited May 2013
    haha yah its late...but I cant seem to open it up in game salad..im on windows...but does this demo show the path after a collision and the direction of the actor changes? I should go to bed now too thanks for your help!!! :)
  • themagicboxthemagicbox Member, PRO Posts: 82
    Oh on this post this is EXACTLY what I want to do...at the bottom of the post there is a video of what it looks like...I want to do that but just faster when the angle is changed

    http://forums.gamesalad.com/discussion/48649/trajectory-path
  • themagicboxthemagicbox Member, PRO Posts: 82
    Anyone?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

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

  • themagicboxthemagicbox Member, PRO Posts: 82
    edited May 2013
    Ohh ok cool I'll check it out...but how do I open it for windows if I don't have the Mac Crestor to save it for windows?

    I watched the video and there is no project file in that demo
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    The project file is the first icon that is clicked on (.proj) in the video. You don't need Mac Creator to "save it for Windows" (which isn't possible any way). Watch the video again and hopefully you can figure it out.

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

  • themagicboxthemagicbox Member, PRO Posts: 82
    edited May 2013
    Well I can watch the video a million times and it will not make the project file show up...what am I doing wrong, this is what the folder looks like when I extract...

    http://postimg.org/image/gsmupap5p/87cdb93f/

    it says in the video they have to be the same versions...the demo is for a lower version than what im using on windows..which is 10.0
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Okay, sorry, I didn't realize that you meant the project file was missing from the folder. Is this version any different? If not, I'm not sure how to open it in Windows. :(

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

  • themagicboxthemagicbox Member, PRO Posts: 82
    thanks! that zip has the project file...but I opened it up and I have no idea how im going to implement that to my game..is there just some math to determine where the ball will go and the dots go into those positions? because I don't know how I could put math to take into account it bouncing off something...it just seems to be for the initial movement...if I were to put a collidable block in the path of the ball, how would the plot points know there is a wall in the way?
  • themagicboxthemagicbox Member, PRO Posts: 82
    edited May 2013
    I tried using the loop behaviour you gave me and it works pretty well..its just that from the initial position to first plot point, there will be a greater distance in between than the other plot points (like in your screen shot how there is a random gap, this happens at the start of the shot for me)..which isn't too bad to deal with..the balls aren't too far apart..but if they look to far on devices I was thinking I could change the width of the plot points and when they get set, change the rotation to the angle the plot point ball is going in (in addition to recording the x and y positions for the plot points, record the linear x and y velocities and use a function to get the angle), so instead of line of dots, its a line of dashes...would that work?

    i decided I might be using the method of loops you sent instead of the hyper loops (which I couldn't get working either haha)

    now the next part is the second part of this post...how do I fire an action everytime the player moves the angle pointer? there must be an easier way than what I can think of right now which is making a condition for each angle... that would take too long haha
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I believe the effect you want is of an arrow pointing in the direction of the "touch." You just constrain the actor using an offset rotation. You can either search the forums for offset rotation or you can try this file.

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

  • themagicboxthemagicbox Member, PRO Posts: 82
    edited May 2013
    alright thank you! :)

    so after testing it on a device I doubt I can have this game the way I wanted it haha....if it moves too fast it goes right through the actor and ive had to slow it down to around 400 to have the ball move in a more predicatable way...I tried density settings (like 50000) but it still goes through...I also tried a rule to check if its position is greater or less that the position of the wall but it "leaks" even further...I tried adding a bounce behaviour, but that made it bounce in unpredictable ways...I tried adding another collidable dummy actor slightly in ontop of a wall and it kind of worked (it would detect it was colliding with the dummy actor right before hitting the real wall) but it was mostly unpredicatable with I tested it on a device....i even tried putting multiple wall actors on top of each other...I don't know what else to try

    I changed some stuff and I can live with the changes but even at a speed of 400 it still seems to go through sometimes..about 7 out of every 10 bounce trials the ball goes a bit into the wall..therefore creating a slightly off trail for the plot points than what it usually should be...

    is there anything else I can do to try?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You can try stopping the ball when it passes a certain x value (where the wall is located) by using When self.position.X ≥ [some value].

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

  • themagicboxthemagicbox Member, PRO Posts: 82
    edited May 2013
    so i tried what you suggested..but changed it a bit...i made two global real attributes for the balls positions. losx and losy....when it collides with the wall, as soon as it hits, it sets the losx an losy to its positions and then if the position of the ball continues to go through the wall, its position is greater or less than the end of the wall, it will set the position to where it initially collided...it kinda worked better but not perfect (which i am thinking is impossible now)...the 7 out of 10 times it goes i nto the wall turned into 9 out of 10 times...but as more bounces happen (i currently have a max of three) it starts to go slightly off...which is fine i just decided to work with it and say the line of sight isn't totally accurate (it fits my game anyways haha) also all the extra work to do the "bug fix" i made wouldnt be worth the extra 2 times of an accurate line of sight...it refreshes around twice a second so its no big deal
  • staffordsignsstaffordsigns Member, PRO Posts: 26
    Hello,

    I'm trying to use ORBZ trajectory demo, however it's not exactly what I need. Very close, but not exact. I would like the trajectory lines to start from a particular actor since in my game the starting actor for each scene will be in a different position for each level.

    The demo is set up so that the trajectory line span is all the way from left side screen to edge of right side screen.

    I was able to change "spawn actor" from "scene" to "actor" which fixes my problem somewhat,...but the (X) location is off.

    Does anyone know how to get the X position to start on the actor (X) location in my screenshot?

    Thank you in advance!
  • staffordsignsstaffordsigns Member, PRO Posts: 26
    Anyone?
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
Sign In or Register to comment.