Inside3D!
     

Touch function and moving objects

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
CocoT



Joined: 14 Dec 2004
Posts: 599
Location: Belly-Gum

PostPosted: Sun May 07, 2006 10:37 pm    Post subject: Touch function and moving objects Reply with quote

Hi there again Smile

Ok, I have a little question for you.
I've created an new object for a mod I'm working on and used its think() function to make it moves from one side to the other, using something like this:

if (self.alternatemoves == 0)
{
self.origin_x = self.origin_x + 2;
self.moveswitch = self.moveswitch + 1;
if (self.moveswitch == 50)
{
self.moveswitch = 0;
self.alternatemoves = 1;
}
if (self.alternatemoves == 1)
{
self.origin_x = self.origin_x - 2;
self.moveswitch = self.moveswitch + 1;
if (self.moveswitch == 50)
{
self.moveswitch = 0;
self.alternatemoves = 0;
}
}


Now, the problem is that, even though my object is moving around, it seems that the touch() function will only be called when the player is located at the original starting point of that object, so not necessarily when he/she touches that object as it appears on the screen, a little bit on the left or on the right of its starting point. Do you have an idea why it is so?

Thanks a lot in advance! Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Sun May 07, 2006 10:48 pm    Post subject: Reply with quote

Use setorigin instead.
_________________
Back to top
View user's profile Send private message Send e-mail
CocoT



Joined: 14 Dec 2004
Posts: 599
Location: Belly-Gum

PostPosted: Mon May 08, 2006 12:13 pm    Post subject: Reply with quote

Yay, it works! Smile

Thanks so much, FrikaC, I really appreciate it Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
RenegadeC



Joined: 15 Oct 2004
Posts: 370
Location: The freezing hell; Canada

PostPosted: Mon May 08, 2006 1:23 pm    Post subject: Reply with quote

Oh CocoT, you crazy coconut you!
Back to top
View user's profile Send private message AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group