[SOLVED] Movement of the object in another object

For questions about using Classic.

Post » Fri Jul 31, 2015 11:02 am

Hello everyone (and sorry for my english),

Imagine an object (let's call him a snake), which moves in any direction and at any angle. When the 'snake' find and eat a 'fruit', then this 'fruit' slowly moves from the head of the snake to his tail. So 'fruit' can move only inside the snake and never outside it.

The question is - how to do that? I just can't make it work as it should.
Any ideas guys?
Last edited by Nazy on Sun Aug 02, 2015 9:59 am, edited 1 time in total.
B
4
Posts: 6
Reputation: 212

Post » Sat Aug 01, 2015 5:16 pm

Easiest method is image points/hotspots along the snake and LERP.

Is your snake just one large sprite, or made up of a few smaller sprites (eg: pieces for head, body, body, body, body, tail) ?
"Construct 4 lets YOU make advanced games! (they wont run anywhere)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
125
S
42
G
17
Posts: 2,228
Reputation: 19,918

Post » Sat Aug 01, 2015 6:36 pm

Snake is just one large sprite and he can grow bigger by eating fruits (by changing his width value). It's very simple snake animations so it's still looks good.

I've never been good at using lerp, so how can I slowly move fruit from one image point of the snake to another?
B
4
Posts: 6
Reputation: 212

Post » Sat Aug 01, 2015 8:37 pm

Okay, here's an example with just image points and a single snake object: https://dl.dropboxusercontent.com/u/4714446/snake.cap

Hope that helps! :)
"Construct 4 lets YOU make advanced games! (they wont run anywhere)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
125
S
42
G
17
Posts: 2,228
Reputation: 19,918

Post » Sun Aug 02, 2015 9:56 am

With such a great example now I know how to do it.
Thank you very much Jayjay! :)
B
4
Posts: 6
Reputation: 212

Post » Sun Aug 02, 2015 4:33 pm

Glad to help Nazy! :)
"Construct 4 lets YOU make advanced games! (they wont run anywhere)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
125
S
42
G
17
Posts: 2,228
Reputation: 19,918


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests