test with different name

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

Post Reply
problème
Posts: 77
Joined: Fri Oct 23, 2015 12:03 am

test with different name

Post by problème » Thu Dec 10, 2015 9:39 pm

Hello

I have image "bird" and others image "branch1","branch2",... . When the bird jump, it stops falling when it touches the floor or a branch, How can i test if he touches a branch, i try to rename branch1,branch2, ... to branch but it's don't work

Code: Select all

command JumpDown
   if ( ( the bottom of image "bird" <>  the top  of image  "floor" )) then -- or (the bottom of image imageHéros <> the top of image "branch" )  ) then 
      set  the location of  image "bird" to (item 1 of the location of  image imageHéros, item 2 of the location of  image imageHéros + 30)
      send "JumpDown" to me in 75 milliseconds 
   end if 
end JumpDown


Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: test with different name

Post by Dixie » Thu Dec 10, 2015 9:46 pm

Read up on 'intersect' in the dictionary...

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

Re: test with different name

Post by Klaus » Sat Dec 12, 2015 2:55 pm

Monsieur problème knows about "intersect": http://forums.livecode.com/viewtopic.php?f=7&t=26008

But obviously not much about meaningful thread titles! :D

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

Re: test with different name

Post by dunbarx » Sat Dec 12, 2015 4:35 pm

Hi.

Do you mean that you do not know in advance which branch the bird will land on?

If so, you still need to test for "intersect", but you also need to test for each branch: (pseudo)

Code: Select all

move bird down
get the number of images
repeat for each image tImage in it
if intersect(bird,tImage)...
Craig

Post Reply