Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
IT Security NachrichtenEntwickler: Claude Code macht Job seelenlos(23.09.2026 um 10:06 Uhr)
IT Security NachrichtenBW/4HANA oder Business Data Cloud: Migration als Grundsatzentscheidung(23.09.2026 um 10:32 Uhr)
IT Security NachrichtenZukunftssichere Unternehmenssteuerung im Mittelstand(23.09.2026 um 10:50 Uhr)
IT Security NachrichtenWhy security belongs in the network(23.09.2026 um 10:00 Uhr)
IT Security NachrichtenNeue Cybersecurity-Pflichten für den Maschinenbau(23.09.2026 um 11:00 Uhr)
IT Security NachrichtenOpus 5.5: Anthropics neues KI-Modell - mehr Leistung, geringere Kosten(23.09.2026 um 09:50 Uhr)
IT Security NachrichtenFBI gehackt: Täter erbeuten angeblich die Daten aller Mitarbeiter(23.09.2026 um 10:30 Uhr)
IT Security NachrichtenTiefpreis-Tage: 13 Deals bei Media Markt & Saturn, die sich lohnen(23.09.2026 um 10:51 Uhr)
IT Security NachrichtenPatchday: Adobe Connect ist unter Android, macOS und Windows verwundbar(23.09.2026 um 10:45 Uhr)
IT Security DownloadsFoxit PDF Reader Download - PDF-Dateien anzeigen(23.09.2026 um 09:39 Uhr)
IT Security NachrichtenEntwickler: Claude Code macht Job seelenlos(23.09.2026 um 10:06 Uhr)
IT Security NachrichtenBW/4HANA oder Business Data Cloud: Migration als Grundsatzentscheidung(23.09.2026 um 10:32 Uhr)
IT Security NachrichtenZukunftssichere Unternehmenssteuerung im Mittelstand(23.09.2026 um 10:50 Uhr)
IT Security NachrichtenWhy security belongs in the network(23.09.2026 um 10:00 Uhr)
IT Security NachrichtenNeue Cybersecurity-Pflichten für den Maschinenbau(23.09.2026 um 11:00 Uhr)
IT Security NachrichtenOpus 5.5: Anthropics neues KI-Modell - mehr Leistung, geringere Kosten(23.09.2026 um 09:50 Uhr)
IT Security NachrichtenFBI gehackt: Täter erbeuten angeblich die Daten aller Mitarbeiter(23.09.2026 um 10:30 Uhr)
IT Security NachrichtenTiefpreis-Tage: 13 Deals bei Media Markt & Saturn, die sich lohnen(23.09.2026 um 10:51 Uhr)
IT Security NachrichtenPatchday: Adobe Connect ist unter Android, macOS und Windows verwundbar(23.09.2026 um 10:45 Uhr)
IT Security DownloadsFoxit PDF Reader Download - PDF-Dateien anzeigen(23.09.2026 um 09:39 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Dropping Detection

Introduction Not too long ago, I published a post titled "Drag and Drop". This post included. What is drag and drop? How does it make your game feel polished Example of some games that use drag and drop wisely. How Drag and Drop…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!




Introduction



Not too long ago, I published a post titled "Drag and Drop".



This post included.




  • What is drag and drop?

  • How does it make your game feel polished

  • Example of some games that use drag and drop wisely.

  • How Drag and Drop changed my whole game.

  • How to Implement Drag and Drop in Mini Micro: A Step-by-Step Guide



But, when I looked carefully at that post , I realised it was only Drag Logic. Although you can drop in that code too, it doesn't detect where I dropped it?



For this, my code needed drop detection.



And that's what I am going to teach today. How to detect a drop on a sprite.



This post will be shorter than my usual post, because there is no need to extend it for no reason at all.



If you haven't read my drag logic tutorial , I highly recommend checking it out first, otherwise, it would be very hard to understand what I teach today, as I am going to use the same code.






Before I start



The Previous Night, or the night I posted the Drag Logic Blog .

I made this simple game, which uses drop detection.



Image description



This was a fun little game I wanted to showcase. Soon enough, I am going to either use it for Learn By Code 1.4 (Not 1.3 because I already have a game called Click_ASAP for that). If you can't wait for Learn By Code 1.3, check out my YouTube I have already uploaded it there.



👉Tutorial for Click ASAP



👉Click ASAP (Learn By Code 1.3)



👉Take Down UFO (Learn By Code 1.4)



👉Previous Code For Drag Logic (Check Out DragAndDrop.ms in 1st Branch)



👉Drag Logic Blog






Drop Detection






Drag Logic






Code Used In Previous Blog






clear

// Load the image
rock = new Sprite
rock.image = file.loadImage("/sys/pics/Rock.png")

initial_position = {"x": 960/2, "y": 640/2}
rock.x = initial_position.x
rock.y = initial_position.y

// Define the sprite bounds for interaction
rock.localBounds = new Bounds
rock.localBounds.width = rock.image.width
rock.localBounds.height = rock.image.height

// Add to scene
display(4).sprites.push rock

// Drag variables
isDragging = false
dragOffset = {"x": 0, "y": 0}

while true
isDown = mouse.button // Left mouse pressed?

if isDown and rock.contains(mouse) and not isDragging then
isDragging = true
dragOffset.x = mouse.x - rock.x
dragOffset.y = mouse.y - rock.y
end if

if isDragging then
// Follow the mouse with drag offset
rock.x = mouse.x - dragOffset.x
rock.y = mouse.y - dragOffset.y

// Stop dragging when mouse released
if not isDown then
isDragging = false

// Snap back to original position
rock.x = initial_position.x
rock.y = initial_position.y
end if
end if

yield
end while









Drop Detection






Drop Detection Logic


First, let's understand the Logic behind drop detection.



Let's take the UFO Game I made. Here, a UFO sprite is constantly moving over the screen on the x-axis. You have to drag and drop the rock onto the UFO so that it loses HP.



UFO is a sprites that we are rendering onto the display(4). We know how sprites work in Mini Micro already.



We can create a Bounds for our UFO sprites so it could detect collision.



In our game loop, we have 2 if blocks.




  • Triggers dragging when the left mouse button is pressed on the sprite and the player isn't dragging currently. This if block sets the offset value and sets isDragging to true


  • Now isDragging is true, and the condition for the previous if block was not isDragging, so we exit that if block and come into the second if block. Second if block used to have nested if blocks, which execute when play stops dragging.




If we think for a while, we need to subtract the health of UFO when:




  • isDragging = true

  • UFO.contains(rock) = true

  • isDown = false



This means the player has dropped the rock sprites onto the UFO sprites . Then we can execute our choice of code.



In my game, I need to:




  • Subtract 10 from UFO's Health

  • Print "UFO under attack."

  • Print the updated health of UFO.

  • Make the rocks come back to the initial position they had.

  • Display a blast sprite on UFO.



But this is for my project, you might be different



The main thing is that there is one thing inside this if block you need to include, no matter what, otherwise you will get unexpected behavior.



As you might have seen, all this code happens when we drop. But actually, if we take a closer look, then even when dropped on UFO isDragging variable is still set to true.



So we need to do isDragging = false



That's all for drop detection. Today I am not going to show code because I have used no new thing that I haven't taught previously, and if I always write the code then you would not improve because




Practice doesn't make a man perfect, but it does make a man 1% better >than yesterday







Outro



Coming Soon:




  • Learn By Code 1.3 - Click ASAP

  • Learn By Code 2.1 - Click ASAP

  • Ebiten - Creating Games with GO

  • Love2D - Creating Games with Lua

  • Pygame - Creating games with Python

  • "fmt" Package in GO



Recommended Post:

Mini Micro





GO





Conceptual





Developer Essential





Learn By Code and Code Review



Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Dropping Detection

Thematisch verwandte Begriffe: Dropping, Detection · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-96258 | A vulnerability has been found in onSite internet GmbH Auktion NG Auktio…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick