How do I drag and drop in a specific space?

Get help using Construct 2

Post » Sun Sep 18, 2016 11:25 pm

When i have a sprite with the behaviors "Drag and Drop", I want to drag, and only drop the object in a specific space, later, the object is fixed in space . It's possible?
B
4
Posts: 9
Reputation: 220

Post » Sun Sep 18, 2016 11:51 pm

Check out this tutorial.

https://www.scirra.com/tutorials/5347/t ... r-tutorial

I believe the first example capx file is what you're looking for.
B
11
S
6
G
15
Posts: 256
Reputation: 9,207

Post » Sun Sep 18, 2016 11:55 pm

The easiest way is

make an small invisible sprite object where your dragedSprite should land
create an instance variable for dragedSprite like "IsDropped = 0"

now to the events
On mouse realese - If dragedSprite overlaps invSprite then move dragedSprite to invSprite and set "IsDropped = 1"

And make a rule where you only can drag objects with instance variable "IsDropped = 0

here is a capx from a tutorial (free book) with I think the same logic
https://www.dropbox.com/s/6kiwvhoa00jdn ... .capx?dl=0
or download the book to learn more about it https://www.scirra.com/blog/172/level-z ... uct-2-book

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707


Return to How do I....?

Who is online

Users browsing this forum: mindragon73 and 23 guests