GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Draw a line

Hello :)

I have an actor that I am moving on the screen. I want it to leave a line behind when it moves.

So I added the "Spawn Actor"
to my "Move" rule which is
"when all of the following are happening => receives a key press: S is: down"
The actor spawn is a dot but instead of keep spawning it as long as S is down, it spawns only once, each time I put S

How do I make it spawn as long as I push S so it looks like a line ?

Also, if you have a better way to make a line behind the actor, feel free to tell me :persevere:

Thank you

Comments

  • -Timo--Timo- Posts: 2,313Member
  • baazulbaazul Posts: 11Member

    I am a total noob so I can be wrong but at a first glance I would say "probably not". I expect to add colision to the line, then another actor which will follow the path of the line.

  • IceboxIcebox Posts: 1,483Member

    if the actor is not moving , every 0 seconds , spawn a dot actor

    if self.motionlinear.velocity.x ≠ 0 or (click on "any" of the conditions)
    if self.motionlinear.velocity.y ≠ 0

    then

    Every 0 seconds
    spawn actor

    Try this

  • baazulbaazul Posts: 11Member
    edited November 2017

    it did not work as it was spawning the actor whenever the player was not moving. But I added your timer to my moving rules and it starts to look like a line. But there is gap between each actor spawned so it is not a straight line. Any idea to make fill the gap ? Apparenty spawn actor every 0 seconds is not fast enough

  • baazulbaazul Posts: 11Member

    I made the actor to move slower so now it looks like a line. Not sure it's the best way to make a line but in terms of graphic. It it working. I will see how well it works with the following features I want to add. thank you for your help everyone :)

  • tatiangtatiang Posts: 11,734Member, Sous Chef, PRO, Senior Sous-Chef
    edited November 2017

    @baazul said:
    Apparenty spawn actor every 0 seconds is not fast enough

    This is true depending on the speed of your actor. Particles work somewhat well but again depending on actor speed:

    How fast is your actor moving? You might need to use a loop:

    (That should have been "in back" of actor.)

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

  • baazulbaazul Posts: 11Member

    thank you. My actor was moving at a speed of 300. It is now moving at the speed of 150.

Sign In or Register to comment.