Bastel mal einen Sprite in Kanal 1. Mach ihn gelb (oder wie auch immer). Kopiere ihn und setze ihn in Kanal 2. Mache sprite 2 rot und verschiebbar und weise ihm folgendes Verhaltensskript zu:
property testCond
on mouseUp me
testCond = 0 -- Testkondition / wenn die 4 ist, wird der sprite "eingelocht"
myTolerance = 100 -- Toleranz / der Bereich in Pixeln um das "Slot" herum, in dem der sprite einrastet
if sprite(the spriteNum of me).left > sprite(1).left - myTolerance then
testCond = testCond + 1
end if
if sprite(the spriteNum of me).right < sprite(1).right + myTolerance then
testCond = testCond + 1
end if
if sprite(the spriteNum of me).top > sprite(1).top - myTolerance then
testCond = testCond + 1
end if
if sprite(the spriteNum of me).bottom < sprite(1).bottom + myTolerance then
testCond = testCond + 1
end if
if testCond = 4 then
sprite(the spriteNum of me).loc = sprite(1).loc
beep
end if
end mouseUp
Im Prinzip isses das. Ich habe hier einen sprite als "Koordinatengeber" verwendet, man kann aber auch die Koordinaten (im Skript zB. sprite(1).top) auch aus kommaseparierten Textfiles auslesen oder am Anfang in Listen festlegen, etc. Das hängt von der sonstigen Konzeption des Programms ab.
grüsse,
Christof
als Antwort auf: [#95742]