Results 1 to 4 of 4
Thread: Make it just A, Help me please
- 04-25-2009, 06:58 AM #1
Member
- Join Date
- Apr 2009
- Posts
- 2
- Rep Power
- 0
Make it just A, Help me please
Hellow,
i'm kind a confuse, please help me
i make 2 object (car and Home)
when object car hit object Home set value for "Path" = A
my code that i write just like this
public boolean foundHome()
{
Actor Hm = getOneObjectAtOffset (0,0, car.class);
if (Hm != null)
{ return true; }
else
{ return false; }
}
public void Act()
{
if (foundHome())
{ Path =Path +"A" }
}
but what i got is "Path = AAAAAAAAAAA"
because image for Home is quite Big compare to image for Car
so the foundHome() condition is "True" repeatedly and make my "Path" became "AAAAAAAA"
what i must do, so i can get Just "A" in my "List"
and can somebody teach me about
thanks a lot
- 04-25-2009, 07:21 AM #2
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
toJava Code:Path =Path +"A"
Java Code:Path = "A"
- 04-25-2009, 10:19 AM #3
Member
- Join Date
- Apr 2009
- Posts
- 2
- Rep Power
- 0
No, i want to add another String into that "Path", not just A . like if the car hit another home (witch i called B), so the Path become AB.
- 04-25-2009, 02:09 PM #4
Senior Member
- Join Date
- Mar 2009
- Posts
- 552
- Rep Power
- 5
In that case, determine what the last character in the string was, and if the char that will be added is NOT the same, add the new char, otherwise, do nothing. Something like this...
Java Code:String path; char nextChar = getLocationChar()//this method determines //what the next character should be if(path.length() = 0) path += nextChar; else if(nextChar != path.charAt(path.length() - 1) path += nextChar;If the above doesn't make sense to you, ignore it, but remember it - might be useful!
And if you just randomly taught yourself to program, well... you're just like me!
Similar Threads
-
want to make an array
By doha786 in forum New To JavaReplies: 3Last Post: 03-29-2009, 01:49 AM -
make this proje to me
By demir12 in forum Suggestions & FeedbackReplies: 1Last Post: 11-27-2008, 01:53 PM -
Trying to make a GUI program
By GettinGwap in forum New To JavaReplies: 2Last Post: 11-04-2008, 11:37 PM -
How do you make a jar file
By alex_cunningham in forum New To JavaReplies: 3Last Post: 07-15-2008, 03:56 AM -
i need help to make this program
By masaka in forum New To JavaReplies: 2Last Post: 03-23-2008, 01:26 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks