game movement

game movement

Page 1 of 1

11 Replies - 2192 Views - Last Post: 24 June 2009 - 08:08 PM Rate Topic: -----

#1 antler   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 21-May 09

game movement

Post icon  Posted 21 May 2009 - 12:22 AM

erm ~ actually i trying to do a pet adopt games
but i duno how to make the pet move randomly in the boxes(room) that i have create
can ani one gv me the coding?
thx @@ :P
Is This A Good Question/Topic? 0
  • +

Replies To: game movement

#2 antler   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 21-May 09

Re: game movement

Posted 21 May 2009 - 01:49 AM

View Postantler, on 20 May, 2009 - 11:22 PM, said:

erm ~ actually i trying to do a pet adopt games
but i duno how to make the pet move randomly in the boxes(room) that i have create
can ani one gv me the coding?
thx @@ :P



can some one pls do gv me some advice pls @@"
blurr now
Was This Post Helpful? 0
  • +
  • -

#3 stayscrisp   User is offline

  • フカユ
  • member icon

Reputation: 1040
  • View blog
  • Posts: 4,325
  • Joined: 14-February 08

Re: game movement

Posted 21 May 2009 - 05:26 AM

Hi there

[rules][/rules]

Can you elaborate more on what you would like help with, I don't know what a pet adopt game is apart from my obvious assumptions and I don't know how you have constructed your blocks. What language are you using?

If you can answer these questions you will get help. :^:
Was This Post Helpful? 0
  • +
  • -

#4 antler   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 21-May 09

Re: game movement

Posted 21 May 2009 - 06:20 PM

View Poststayscrisp, on 21 May, 2009 - 04:26 AM, said:

Hi there

[rules][/rules]

Can you elaborate more on what you would like help with, I don't know what a pet adopt game is apart from my obvious assumptions and I don't know how you have constructed your blocks. What language are you using?

If you can answer these questions you will get help. :^:



erm ~ i using bloodshed dev C++
i just try to do a game ~
i wan to make a children play wif it
it is a simple game
got 6 button
1. play button
2. feed button
3. clear button
4.5.6 background image (chosable)
then i would like to make the pet moving/loitering in the monitor while the user do nth to it.
so how would it be done ?
@@" i confuse bout it very long time ago
Was This Post Helpful? 0
  • +
  • -

#5 UG Cyber   User is offline

  • D.I.C Addict

Reputation: 36
  • View blog
  • Posts: 611
  • Joined: 24-July 08

Re: game movement

Posted 22 May 2009 - 02:42 PM

View Postantler, on 21 May, 2009 - 05:20 PM, said:

View Poststayscrisp, on 21 May, 2009 - 04:26 AM, said:

Hi there

[rules][/rules]

Can you elaborate more on what you would like help with, I don't know what a pet adopt game is apart from my obvious assumptions and I don't know how you have constructed your blocks. What language are you using?

If you can answer these questions you will get help. :^:



erm ~ i using bloodshed dev C++
i just try to do a game ~
i wan to make a children play wif it
it is a simple game
got 6 button
1. play button
2. feed button
3. clear button
4.5.6 background image (chosable)
then i would like to make the pet moving/loitering in the monitor while the user do nth to it.
so how would it be done ?
@@" i confuse bout it very long time ago

Im confused with your english....we need to see what you have, your code. We require that we see some effort before we toss something at you.
Was This Post Helpful? 0
  • +
  • -

#6 virgul   User is offline

  • D.I.C Regular

Reputation: 44
  • View blog
  • Posts: 269
  • Joined: 18-March 09

Re: game movement

Posted 24 May 2009 - 11:43 AM

ok, so im not sure how to do this in C++, so ill give you an example using java.

ok, but first. you need to have your animals current direction setup. doesnt really matter if its North East South West, or out of 360. either way, you will need to have some system set up so your program can decide the next movement. thats is unless you dont mind the animal just kinda flipping directions.

so with the direction, lets say its out of 360, if you are currently at 180, your animal should only really be able to turn no more then lets say 15 degrees on each side. so you would do something like this

(in java)
int direction = dog1.getDirection();
//...(your other codes)

int newDirection = (int)(Math.random() * 30);

if(newDirection > 15)
	newDirection+= direction;
else
	newDirection -= direction;

dog1.setDirection(newDirection);



after this is done you will just do a repaint. this will only change the direction of the animal though. if you want to have it move as well you will need to build a movement method.
Was This Post Helpful? 0
  • +
  • -

#7 antler   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 21-May 09

Re: game movement

Posted 24 May 2009 - 07:10 PM

View Postvirgul, on 24 May, 2009 - 10:43 AM, said:

ok, so im not sure how to do this in C++, so ill give you an example using java.

ok, but first. you need to have your animals current direction setup. doesnt really matter if its North East South West, or out of 360. either way, you will need to have some system set up so your program can decide the next movement. thats is unless you dont mind the animal just kinda flipping directions.

so with the direction, lets say its out of 360, if you are currently at 180, your animal should only really be able to turn no more then lets say 15 degrees on each side. so you would do something like this

(in java)
int direction = dog1.getDirection();
//...(your other codes)

int newDirection = (int)(Math.random() * 30);

if(newDirection > 15)
	newDirection+= direction;
else
	newDirection -= direction;

dog1.setDirection(newDirection);



after this is done you will just do a repaint. this will only change the direction of the animal though. if you want to have it move as well you will need to build a movement method.



thanks so much for the instruction....
i hope that will help me a lot
try figure it first. but ur coding is in java script
mine is in the opengl format
i wonder whether it can be used or not
Was This Post Helpful? 0
  • +
  • -

#8 chuckb   User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 211
  • Joined: 29-May 09

Re: game movement

Posted 30 May 2009 - 04:01 PM

Hi Antler,
1) Can you use a program like Windows Paint to "sketch or draw" a screen shot describing your program? If you post it and add it here as an "image" it would help us to understand your planned game.

2) Most game characters have a "class" or a "set of variables" describing their attributes. Do you have a "Pet class" or something similar? If not are you using a STRUCT or a collection of variables to describe the pet?

3) What graphics will you be using? Is it OpenGL?

Virgul's example above in Java is easy to understand once you recognize his use of "direction". Your "drawing" would be helpful in picking a good method to make the "pet look smart".

I don't like to write code for people but I will write a "pseudo-code" snippet if possible.

Incidentally, what is your native language? Are you using a translation program from your language to English?

Regards,
Chuck
Was This Post Helpful? 0
  • +
  • -

#9 antler   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 21-May 09

Re: game movement

Posted 15 June 2009 - 02:29 AM

View Postchuckb, on 30 May, 2009 - 03:01 PM, said:

Hi Antler,
1) Can you use a program like Windows Paint to "sketch or draw" a screen shot describing your program? If you post it and add it here as an "image" it would help us to understand your planned game.

2) Most game characters have a "class" or a "set of variables" describing their attributes. Do you have a "Pet class" or something similar? If not are you using a STRUCT or a collection of variables to describe the pet?

3) What graphics will you be using? Is it OpenGL?

Virgul's example above in Java is easy to understand once you recognize his use of "direction". Your "drawing" would be helpful in picking a good method to make the "pet look smart".

I don't like to write code for people but I will write a "pseudo-code" snippet if possible.

Incidentally, what is your native language? Are you using a translation program from your language to English?

Regards,
Chuck


erm ~ i think my english is not so good
sorry and please try to be understanding ~
i paste my picture here

try gives me more comments
thanks

Attached File(s)

  • Attached File  a.bmp (1.37MB)
    Number of downloads: 102

Was This Post Helpful? 0
  • +
  • -

#10 frostyraver   User is offline

  • D.I.C Head
  • member icon

Reputation: 13
  • View blog
  • Posts: 195
  • Joined: 21-April 09

Re: game movement

Posted 24 June 2009 - 07:59 PM

Is this what you're after? It's my old program with old code, I could rewrite it and fix it up and apply source if it's what you want, and plus a tutorial also.

Attached File(s)


Was This Post Helpful? 1
  • +
  • -

#11 antler   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 21-May 09

Re: game movement

Posted 24 June 2009 - 08:06 PM

View Postfrostyraver, on 24 Jun, 2009 - 06:59 PM, said:

Is this what you're after? It's my old program with old code, I could rewrite it and fix it up and apply source if it's what you want, and plus a tutorial also.

:^:
thanks lot but now don't need already
I have already done ~
thanks dude
Was This Post Helpful? 0
  • +
  • -

#12 frostyraver   User is offline

  • D.I.C Head
  • member icon

Reputation: 13
  • View blog
  • Posts: 195
  • Joined: 21-April 09

Re: game movement

Posted 24 June 2009 - 08:08 PM

View Postantler, on 24 Jun, 2009 - 07:06 PM, said:

View Postfrostyraver, on 24 Jun, 2009 - 06:59 PM, said:

Is this what you're after? It's my old program with old code, I could rewrite it and fix it up and apply source if it's what you want, and plus a tutorial also.

:^:
thanks lot but now don't need already
I have already done ~
thanks dude



Yeah no problem, I might rewrite this into a tutorial, people might learn a thing or 2 about timers and displaying text on a bar as such.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1