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- Member Posts: 2,313
  • baazulbaazul Member Posts: 11

    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 Member Posts: 1,485

    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 Member Posts: 11
    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 Member Posts: 11

    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 Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    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 Member Posts: 11

    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.