Vector Graphics Experiments

Creating Games? Developing something for fun?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Hutchboy
Posts: 51
Joined: Wed Aug 01, 2018 2:57 pm
Contact:

Re: Vector Graphics Experiments

Post by Hutchboy » Wed Mar 06, 2024 2:21 am

Hi,
Thanks for the feed back on the LED experiments and I'm studying the code to scale objects.

I have an updated version of my LED stack almost ready to go, including a demo of a working 4 LED panel that can be connected from 3 different mini-apps on the card: a timer, a text entry, and a mini game. I really wanted to be able to drag a line from one mini app to the display to activate the display but drawing that connecting line has kept me occupied for the last few days.

The attached stack demos a working strategy for creating connecting lines, maintaining the connection while objects are moved, but disconnecting the lines has me temporarily stumped. Any ideas?

- Mike
Attachments
MGB Connecting Objects.livecode.zip
(2.73 KiB) Downloaded 17 times

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Vector Graphics Experiments

Post by bn » Wed Mar 06, 2024 9:25 am

Hutchboy wrote:
Wed Mar 06, 2024 2:21 am
The attached stack demos a working strategy for creating connecting lines, maintaining the connection while objects are moved, but disconnecting the lines has me temporarily stumped. Any ideas?
Hi Mike,

the short answer is to change the code in the template script regarding deleting graphic "line" to this code:

Code: Select all

         else
            ## uncouple the deletion of graphic "line" from its script 
            put the long iD of me into tID
            send "delete tID" to this card in 5 milliseconds
            ## end uncouple
         end if
         exit mouseDown
Kind regards
Bernd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Vector Graphics Experiments

Post by bn » Thu Mar 07, 2024 8:10 pm

Mike,

If you want to 'embellish' your line graphic here is a change to your createALine handler:

Code: Select all

command createALine pObject
   if there is not a graphic "Line" and gIsDragging then
      create graphic "Line"
      set the endArrow of the last graphic to true
      set the dashes of the last graphic to 4
      ## change for markers
      set the style of the last graphic to "polygon" ## has to be 'polygon' for markers
      
      ## a square
      set the markerPoints of the last graphic to "-4,0" & cr & "0,-4" & cr & "4,0" & cr & \
            "0,4" & cr & "-4,0"
      
      ## large circle
      --      set the markerPoints of the last graphic to "-7,0" & cr & "-6,-2" & cr & "-5,-4" & cr & \
      --            "-3,-6" & cr & "0,-7" & cr & "3,-6" & cr & \
      --            "5,-4" & cr & "6,-2" & cr & "7,0" & cr & \
      --            "6,2" & cr & "5,4" & cr & "3,6" & cr & \
      --            "0,7" & cr & "-3,6" & cr & "-5,4" & cr & \
      --            "-6,2" & cr & "-7,0"
      
      set the markerFilled of the last graphic to true
      set the markerDrawn of the last graphic to true
      set the hiliteColor of the last graphic to "255,0,0"
      set the borderColor of the last graphic to "255,0,0"
      ## end change for markers
      set the points of the last graphic to the loc of graphic pObject & CR & the mouseLoc
      if there is a button "Line Script Template" then
         set the script of the last graphic to the script of button "Line Script Template"
      end if
   else
      exit createALine
   end if
end createALine
It makes it easier for the user to hit the end of the graphic.

Kind regards
Bernd

Post Reply

Return to “Games”