actor n background

Non-platform specific questions.

Re: actor n background

Postby dzuncoi » Mon Jun 11, 2012 4:24 pm

anyone can help me ? i still cant fix it :(
dzuncoi
 
Posts: 33
Joined: Tue Jun 05, 2012 11:15 am
Score: 0 Give a positive score

Re: actor n background

Postby skydereign » Mon Jun 11, 2012 5:01 pm

Please be patient (at least wait a day for people to respond between posts). gE cuts an image into n frames. For your image, it cuts it into 7 frames. The image is 397 pixels in width, so each frame is 56 pixels wide. If you want to see the first frame, just look at the first 56 pixels (in width). You'll notice that hercules is not centered in the frame. Same for most of the other frames.

To animate that properly, hercules needs to be in the center of each frame. I suggest taking a look at other animations. It should become fairly obvious why your animation is messing up, and how you should fix it.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: actor n background

Postby dzuncoi » Tue Jun 12, 2012 7:50 am

thank u, i got it, now i can make it move better
dzuncoi
 
Posts: 33
Joined: Tue Jun 05, 2012 11:15 am
Score: 0 Give a positive score

Re: actor n background

Postby dzuncoi » Wed Jun 13, 2012 4:42 pm

hello guys, can anyone show me how to create animation randomly ? such as i have 2 run-right animations n add them to key down event (both with "right" key) n i want it moves randomly with these animations.
dzuncoi
 
Posts: 33
Joined: Tue Jun 05, 2012 11:15 am
Score: 0 Give a positive score

Re: actor n background

Postby skydereign » Wed Jun 13, 2012 4:47 pm

There is a function called rand, which returns a random number between 0 and the number you pass it. You can use this to make different things happen randomly.
Code: Select all
int random = rand(2); // returns a number between 0 and 2 (including floating point)
// setting it to an int casts it (making random equal 0 or 1)
switch(random)
{
    case 0:
    // Change animation to first run
    break;

    case 1:
    // Change animation to second run
    break;
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: actor n background

Postby dzuncoi » Wed Jun 13, 2012 4:53 pm

oh, so simple :o thank u, btw, where can i get these kinds of code ?
dzuncoi
 
Posts: 33
Joined: Tue Jun 05, 2012 11:15 am
Score: 0 Give a positive score

Re: actor n background

Postby dzuncoi » Wed Jun 13, 2012 4:56 pm

ar, what if it returns to 2 ? because u make it equal to rand(2), so i think it gets 3 values: 0,1,2 right?
dzuncoi
 
Posts: 33
Joined: Tue Jun 05, 2012 11:15 am
Score: 0 Give a positive score

Re: actor n background

Postby skydereign » Wed Jun 13, 2012 5:11 pm

I mentioned in the comment that rand(2) when set equal to an int will equal only 0 or 1. rand(2) will never return 2, it may though return 1.9999. That being said if you set an int equal to any floating point number, C will just remove the floating point.
Code: Select all
int a = 1.5; // a will be equal 1
int b = 2.9; // b will equal 2


dzuncoi wrote:btw, where can i get these kinds of code ?

You search the forums, and by doing so learn a bit C and gE.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: actor n background

Postby dzuncoi » Wed Jun 13, 2012 5:15 pm

i got it :D thank you for helping me so far :D
dzuncoi
 
Posts: 33
Joined: Tue Jun 05, 2012 11:15 am
Score: 0 Give a positive score

Re: actor n background

Postby dzuncoi » Mon Jun 18, 2012 1:28 pm

Hello guys, im going to finish my small game :D i still have some troubles and need your help. That's about physical response between player and the ground, it seems not real, like this: http://www.youtube.com/watch?v=rz9pqEBpWIM&feature=youtu.be (i dont know how to post a video)
In this video, i want the player not able to reach the block but he still does :( i just use state method, so is there any others way to make it real ?
dzuncoi
 
Posts: 33
Joined: Tue Jun 05, 2012 11:15 am
Score: 0 Give a positive score

Re: actor n background

Postby skydereign » Mon Jun 18, 2012 5:01 pm

You need to have a collision event for the left and right sides of the ground actor. I recommend using the non-stick method for that collision.
Code: Select all
double yvel = yvelocity; // save yvelocity's value
//put the PhysicalResponse here
yvelocity = yvel; // set yvelocity back to yvel
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: actor n background

Postby dzuncoi » Tue Jun 19, 2012 4:16 am

I used that already :( you sent me this page http://game-editor.com/State_Method in page 1 and i follow this tutorial, maybe there are somethings wrong in my code, let me check it
dzuncoi
 
Posts: 33
Joined: Tue Jun 05, 2012 11:15 am
Score: 0 Give a positive score

Re: actor n background

Postby skydereign » Tue Jun 19, 2012 4:59 am

Ah, yes. That example has the proper code, and I believe looks pretty realistic (there is a ged I made somewhere that goes well with that tutorial). Perhaps you didn't set the collision event to repeat (which would allow the player to pass through the wall).
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: actor n background

Postby dzuncoi » Tue Jun 19, 2012 5:10 am

I've just delete and write all the codes again and they seem better :D there are maybe some mistakes somewhere :D
dzuncoi
 
Posts: 33
Joined: Tue Jun 05, 2012 11:15 am
Score: 0 Give a positive score

Re: actor n background

Postby dzuncoi » Mon Jun 25, 2012 5:07 pm

hello guys, i need some help, this is my problem : http://www.youtube.com/watch?v=YMCtH5jFmhY
My player animation is so strange when i press right or left key, can you help me to fix it?
dzuncoi
 
Posts: 33
Joined: Tue Jun 05, 2012 11:15 am
Score: 0 Give a positive score

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron