Page 1 of 1

early stages of a game

PostPosted: Thu Feb 23, 2012 10:11 am
by Morpheas
screenshot.gif

Hi.
My first game is in the making. :)
not named yet
download the 3 attachments of test.part01-03.rar below

thx to skydereign for help with the coding.

many features missing :)
and many fixes must be done :)
tell me ur opinion for the graphics so far.

Re: early stages of a game

PostPosted: Thu Feb 23, 2012 4:12 pm
by Morpheas
does any1 knows how does GE computes which part of the animation position is the place where all the code goes?
is it the middle of the pic. or something else ?
ex. lets say u put an actor with many pics for animation like my cannon see photo above.
is there a way to tell an actor to follow the end of the barrel muzzle whatever the rotation?

Re: early stages of a game

PostPosted: Thu Feb 23, 2012 4:25 pm
by JamesLeonardo32
Morpheas wrote:does any1 knows how does GE computes which part of the animation position is the place where all the code goes?
is it the middle of the pic. or something else ?
ex. lets say u put an actor with many pics for animation like my cannon see photo above.
is there a way to tell an actor to follow the end of the barrel muzzle whatever the rotation?

I may have read wrong but the code you may need is "animpos" which tells the animation position.
example:
Code: Select all
animpos=1;//number=frame


I'll have a go shortly, and welcome to GE Game making ;)

+Point

Re: early stages of a game

PostPosted: Thu Feb 23, 2012 5:00 pm
by Morpheas
i mean in the cannon ex. the coding by default goes to the base of the barrel and a little lower. is there a way to tell that point to change and follow the barrel's end?
i hope u understand me:P
English is not my native language
thx for the point

Re: early stages of a game

PostPosted: Thu Feb 23, 2012 9:15 pm
by skydereign
The xy position of any normal actor is the center of it. Since you are using a rotating actor you can use trig to determine the position of the end of the barrel.
Code: Select all
int end_x = cannon.x + cos(degtorad(direction(cannon.xscreen, cannon.yscreen, xmouse, ymouse)))*30; // 30 is the radius (most likely can be width)
int end_y = cannon.y - sin(degtorad(direction(cannon.xscreen, cannon.yscreen, xmouse, ymouse)))*30; // 30 could be width

// now end_x and end_y is the position of the end of the barrel

Re: early stages of a game

PostPosted: Fri Feb 24, 2012 3:02 pm
by Morpheas
a little more explaining pls i didn't understand where to put it or what to do. all:P
do i declare it as a global variable?:)and then what?
sorry if im getting tiring...
thx for your patience.

Re: early stages of a game

PostPosted: Fri Feb 24, 2012 8:08 pm
by skydereign
That just showed the math to find the position of the end of the barrel. Those coordinates are the end of the barrel, here it is applied.