move to the points of graphic

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

move to the points of graphic

Post by Samuele » Wed Jan 12, 2022 8:57 pm

hi, i've encountered a minor problem when livecode runs this script

Code: Select all

on GameOver
   show image "GameOverSign"
   move image "GameOverSign" to the points of graphic "Curve" in 3 seconds without waiting
   show graphic "GrayThing"
   show field "RestartInfo"
end GameOver
it shows it in fragments and not clear is there a better way? thanks.
and another question, how can i make something happen after the image finishes the 'path'?
Samuele.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: move to the points of graphic

Post by richmond62 » Wed Jan 12, 2022 9:06 pm

How about inserting something like this into your script:

set the visible of image "GameIsFinished" to true

Code: Select all

on GameOver
   show image "GameOverSign"
   move image "GameOverSign" to the points of graphic "Curve" in 3 seconds without waiting
   show graphic "GrayThing"
   show field "RestartInfo"
   wait 3 secs
   set the vis of image "GameIsFinished" to true
end GameOver

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: move to the points of graphic

Post by dunbarx » Wed Jan 12, 2022 9:56 pm

Hi.

How many points are there in grc "Curve? I assume not hundreds.

If you specify three seconds, and there are only handfuls or so of points, you must understand that LC is merely following your instructions. To smooth out the action, you must increase the number of points in the graphic, possibly dramatically. Can you do this?

Craig.

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: move to the points of graphic

Post by Samuele » Fri Jan 14, 2022 2:45 am

dunbarx wrote:
Wed Jan 12, 2022 9:56 pm
How many points are there in grc "Curve? I assume not hundreds.
i don't know but from this screenshot
Immagine 2022-01-14 024005.png
Immagine 2022-01-14 024005.png (3.86 KiB) Viewed 5979 times
yo can see that the silidebar is small so it goes down a lot, the strange thing is that the problem has arisen only recently and for example before it wasn't there.
thanks
Samuele.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: move to the points of graphic

Post by dunbarx » Fri Jan 14, 2022 5:26 am

Looks like a fair number of points. Ask:

Code: Select all

answer the number of lines of the points of grc "curve"
Craig

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: move to the points of graphic

Post by Samuele » Sun Jan 16, 2022 2:30 pm

Hi, the aswer that came up is "395".
Thanks.
Samuele.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: move to the points of graphic

Post by richmond62 » Sun Jan 16, 2022 3:04 pm

it shows it in fragments
Do you mean that you cannot see the image as it moves properly?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: move to the points of graphic

Post by richmond62 » Sun Jan 16, 2022 3:58 pm

SShot 2022-01-16 at 16.56.49.png
-
Well, I had some fun today. :D

630 points.
Attachments
POINTY.livecode.zip
Stack
(22.29 KiB) Downloaded 147 times

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: move to the points of graphic

Post by Samuele » Sun Jan 16, 2022 5:29 pm

Ok, so that's exactly my script but it doesn't do like that (well a few weeks ago, yes, but then I changed something and now it's weird). it's like livecode shows the image that i want to move to the points of the graphic then the moving stops and livecode hides the image then reshow it and move to the points of the graphic. all of this pretty fast, i checke for hide ans show scripts but i didn't find any relation to this script...
Samuele.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: move to the points of graphic

Post by richmond62 » Sun Jan 16, 2022 5:39 pm

If you want to you can either post your stack here, or, if you want it to be private,
you can send it to me as a private message and I can have a look at it.

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: move to the points of graphic

Post by Samuele » Sun Jan 16, 2022 6:13 pm

In the meantime i think the problem is in this code but i can't quite understand where.

Code: Select all

else if field "timer" = 0 
      then
      GameOver
      aeStopMoving "all"
      DisableObjects
      show button "Restart" with visual effect dissolve very fast
      show widget "Info" 
      show widget "Home" 
      show widget "Settings" 
      HighScore
      HideBonuses
   end if
end ActivateTimer

Code: Select all

on GameOver
   show image "GameOverSign"
   move image "GameOverSign" to the points of graphic "Curve" in 3 seconds without waiting
   show graphic "GrayThing"
   show field "RestartInfo"
end GameOver
Thanks!
Samuele.

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: move to the points of graphic

Post by Klaus » Sun Jan 16, 2022 6:39 pm

Buonasera Samuele,

I think the "visual effect" kills your "moving".
Comment that line out or leave the effect out and see if that works as exspected:

Code: Select all

else if field "timer" = 0 
      then
      GameOver
      aeStopMoving "all"
      DisableObjects
      ## show button "Restart" with visual effect dissolve very fast
      show button "Restart"
      show widget "Info" 
      show widget "Home" 
      show widget "Settings" 
      HighScore
      HideBonuses
   end if
end ActivateTimer
If it works then the visual effect is the problem.
Remember that LC is very fast, so all this:

Code: Select all

...
     GameOver ## including the moving image!
      aeStopMoving "all"
      DisableObjects
...
will take a millisecond or less, so LC will try to let the visual effect happen at the same time
as moving the image and that does not work since visual effects will always lock the screen!

Code: Select all

-> show button "Restart" with visual effect dissolve very fast
Obviously we cannot have both... 8)


Best

Klaus

Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: move to the points of graphic

Post by Samuele » Sun Jan 16, 2022 6:54 pm

allright, thanks, i tried without the visual effect and it doesn't solve the problem entirely, it's only faster but the problem remains.
thanks
Samuele.

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: move to the points of graphic

Post by Klaus » Sun Jan 16, 2022 7:45 pm

OK, as othe already said, there may be just too many points in the graphic, try to reduce them.

From your screenshot you could e.g. remove coublettes

Code: Select all

...
159,9
159,9
...
And you will not need every pixel so you could remove some steps.
Instead of:

Code: Select all

...
159,9
159,10
...
159,15
159,16
...
Use:

Code: Select all

...
159,9
159,15
...
and not every pixel in beetween!
That way your movement will be much smoother, which is you current problem, right?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: move to the points of graphic

Post by richmond62 » Sun Jan 16, 2022 7:48 pm

coublettes
Um; 'doublets' ?

Post Reply