Sprite pressed challenge solved


#1

https://c.gethopscotch.com/p/y6xa9es4x

When a sprite is pressed and goes to the last touch, the sprites center goes to the last touch.
Can a sprite be pressed and move while keeping its position below the pressed area.
Like if you press a coin and slide it around the coins center doesn't magically go
To where you are pressing the coin, but keeps its position when touching your finger.

Please remix the linked project and publish here if you can think of a way to do this.
@TheRealBlah


#2

Hmm... This is a very interesting challenge! I can't even think about how you would do it! I guess I'm not at that level of advanced code... But good idea!


#3

I wonder if when a sprite is pressed, the distance from the sprites x position to the last touch x is measured and forever sets the sprites x position to the distance measured to the last touch x


#4

Challenge accepted!


#5

If you figure this out you'll be the first person to ever code this.
I have to sleep now. It's past 11:00pm for me.
Good night


#6

Might take a while tho... I know exactly how to to but Hopscotch crashes whenever I add an operator –_–


#7

Do mean sprite as in character? you must code on Scratch too...


#8

I LOVE this challenge idea! This problem comes up quite often when I'm working on a project. I've spent a long time trying to figure out how to do it. I haven't quite figured it out yet!


#9

https://c.gethopscotch.com/p/y6yzrk3ho
This is some progress I made.
When the area around the first 3 squares of the sprite is pressed, the sprite can slowly be moved left and right.
The code used can be copied/edited for when the area of the last 3 squares is pressed and for the sprites y position. The sprite still has to be slowly dragged.
I'm trying to speed the sprite up when dragging and still be accurate


#10

@Stradyvarious
Like this?
https://c.gethopscotch.com/p/y70zunxvo
Edit: It doesn't work in the web player, but works in the app. Search for "Sprite Slider" or under ThinBuffaloSr

I assumed you wanted the sprite to be constrained to move left & right only.


#11

I might have misunderstood the question. This is all that was required to make it slide back and forth without snapping to the spot that is touched:

To follow anywhere from the touched spot, you'd just add a 'Y offset' in a similar fashion.


#12

I added a project 'Sprite Slider (X & Y)' that follows your finger anywhere.

Since the last one didn't work right in the web player, I'm going to assume this one won't either so I'm not going to bother with a link.


#14

Your way was exactly what I was thinking to do.
A tap to get the x-y distance to the touch location from the sprite centre
And Press to keep the sprite at the distance recorded by the tap.
Great job.


#15

That was exactly what I did, only difference was that I wrote "Offset X" and "Offset Y" instead of "X Offset" XD


#17

Sorry I already quit. Please I beg you please don't tag me. This is an automated message.


#18

Honestly, if you already quit, then just leave the forums. If you can't, I can help you by blocking or suspending you.


#19

@CreationsOfaNoob I saw your project with the Sprite pressed thing. That is SO cool! I've always wondered if there was a way to do that! Are you allowing other Hopscotchers to use your code from that project?

P.s. I LOVE all your projects! They are so inspiring and creative. You are my #1 favorite Hopscotcher!


#20

FTU: Of course! One of my biggest goals on Hopscotch is to find new ways to use Hopscotch, and inventing new techniques!

Thank you so much :D