RPG movement System 2

Post here your demos and examples with the source files.
Forum rules
Always post the games with a screenshot.
The file must have the ged and data files (complete game source)
Use the forum attachment to post the files.
It is always better to use the first post to put the game files

RPG movement System 2

Postby Hblade » Sat Sep 17, 2011 12:59 am

Test ^^
Smooth View, (Thanks to GAG), View Limiting (Thanks to Skydereign) Perfect Wall Colision, can't exit view :)

TONS of if's in the code of 'player' xD
Attachments
screen.png
RPG.zip
(155.88 KiB) Downloaded 381 times
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: RPG movement System 2

Postby Hblade » Sat Sep 17, 2011 3:03 am

OH! There is a fog animation behind the floor I forgot to drag it back up, you can if you want
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: RPG movement System 2

Postby CoFFiN6 » Sat Sep 17, 2011 6:57 am

Nice! It makes a perfect stop against walls
Don't run faster then the dragon, run faster than your friends :P
User avatar
CoFFiN6
 
Posts: 49
Joined: Sun Sep 11, 2011 8:17 pm
Location: South Africa
Score: 4 Give a positive score

Re: RPG movement System 2

Postby Hblade » Sat Sep 17, 2011 5:27 pm

Thanks :D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: RPG movement System 2

Postby jimmynewguy » Sat Sep 17, 2011 8:04 pm

Looks really good, but there's a lot of code going on in the collisions and movement I would try to avoid. I'm not a huge fan of long code :lol:

On the bod actor->draw I would have:
Code: Select all
char *key=GetKeyState();
x += 2*(key[KEY_RIGHT]-key[KEY_LEFT]);
y += 2*(key[KEY_DOWN]-key[KEY_UP]);


Then collision->anyside->repeat since were using x/y + instead of velocity, just this will do.
Code: Select all
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000, 1.000000, 0.000000, 1.000000);


Then I'd get rid of all the stop animations the player has, since they are just the fourth frame of the walking animations and use this for the draw actor:
Code: Select all
char *key=GetKeyState();
int dir = (3*key[KEY_UP]+5*key[KEY_LEFT]+7*key[KEY_DOWN]+9*key[KEY_RIGHT]);

if(dir)
ChangeAnimationDirection("Event Actor", FORWARD);

switch(dir)
{
case 0: case 10: case 14:
ChangeAnimationDirection("Event Actor", STOPPED);
animpos = 4;
break;
case 3:ChangeAnimation("Event Actor", "Up", NO_CHANGE);
break;
case 5:ChangeAnimation("Event Actor", "Left", NO_CHANGE);
break;
case 7:ChangeAnimation("Event Actor", "Down", NO_CHANGE);
break;
case 9:ChangeAnimation("Event Actor", "Right", NO_CHANGE);
break;
}


Again, that's just me hating long codes. It doesn't work EXACTLY like how you had it before (in the since of holding keys it will go diagonal, easy fix if it bugs you a lot. And when the player runs into a wall he doesn't stop animating, also easy fix if it bugs you.) But I was just showing you my way since, well I'm not sure. I just like blabbing I guess! :)

EDIT: That post seems a bit snooty, don't change your code because of me :lol: I was just being an example
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: RPG movement System 2

Postby Hblade » Sat Sep 17, 2011 10:29 pm

You are truely a genius :)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: RPG movement System 2

Postby jimmynewguy » Sun Sep 18, 2011 2:53 am

If you met me not on the internet, you probably wouldn't think that! :lol: Just hope I somehow helped a little.
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: RPG movement System 2

Postby Hblade » Sun Sep 18, 2011 4:51 am

you did :D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: RPG movement System 2

Postby SuperSonic » Tue Sep 20, 2011 8:40 pm

This is really great, good job :wink:

It would be really cool though if you make him move on a grid. I did something like that once and was going to upload it but I can't seem to find it :roll:
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1443
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: RPG movement System 2

Postby Hblade » Wed Sep 21, 2011 2:33 am

lol yeah Im going to make another demo later today :) And thanks for the positive comments! :D

(well technically it's 10:33 at night xD..)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: RPG movement System 2

Postby Hblade » Wed Sep 21, 2011 2:39 am

jimmynewguy wrote:Looks really good, but there's a lot of code going on in the collisions and movement I would try to avoid. I'm not a huge fan of long code :lol:

On the bod actor->draw I would have:
Code: Select all
char *key=GetKeyState();
x += 2*(key[KEY_RIGHT]-key[KEY_LEFT]);
y += 2*(key[KEY_DOWN]-key[KEY_UP]);


Then collision->anyside->repeat since were using x/y + instead of velocity, just this will do.
Code: Select all
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000, 1.000000, 0.000000, 1.000000);


Then I'd get rid of all the stop animations the player has, since they are just the fourth frame of the walking animations and use this for the draw actor:
Code: Select all
char *key=GetKeyState();
int dir = (3*key[KEY_UP]+5*key[KEY_LEFT]+7*key[KEY_DOWN]+9*key[KEY_RIGHT]);

if(dir)
ChangeAnimationDirection("Event Actor", FORWARD);

switch(dir)
{
case 0: case 10: case 14:
ChangeAnimationDirection("Event Actor", STOPPED);
animpos = 4;
break;
case 3:ChangeAnimation("Event Actor", "Up", NO_CHANGE);
break;
case 5:ChangeAnimation("Event Actor", "Left", NO_CHANGE);
break;
case 7:ChangeAnimation("Event Actor", "Down", NO_CHANGE);
break;
case 9:ChangeAnimation("Event Actor", "Right", NO_CHANGE);
break;
}


Again, that's just me hating long codes. It doesn't work EXACTLY like how you had it before (in the since of holding keys it will go diagonal, easy fix if it bugs you a lot. And when the player runs into a wall he doesn't stop animating, also easy fix if it bugs you.) But I was just showing you my way since, well I'm not sure. I just like blabbing I guess! :)

EDIT: That post seems a bit snooty, don't change your code because of me :lol: I was just being an example


There is a glitch in this code ;D
Hold left right, and up at the same time, then release up and press down (While still holding left and right), the player will walk up but go down :D


Other than that I'm VERY impressed! :)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: RPG movement System 2

Postby Hblade » Fri Sep 23, 2011 10:51 pm

jimmynewguy wrote:Looks really good, but there's a lot of code going on in the collisions and movement I would try to avoid. I'm not a huge fan of long code :lol:

On the bod actor->draw I would have:
Code: Select all
char *key=GetKeyState();
x += 2*(key[KEY_RIGHT]-key[KEY_LEFT]);
y += 2*(key[KEY_DOWN]-key[KEY_UP]);


Then collision->anyside->repeat since were using x/y + instead of velocity, just this will do.
Code: Select all
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000, 1.000000, 0.000000, 1.000000);


Then I'd get rid of all the stop animations the player has, since they are just the fourth frame of the walking animations and use this for the draw actor:
Code: Select all
char *key=GetKeyState();
int dir = (3*key[KEY_UP]+5*key[KEY_LEFT]+7*key[KEY_DOWN]+9*key[KEY_RIGHT]);

if(dir)
ChangeAnimationDirection("Event Actor", FORWARD);

switch(dir)
{
case 0: case 10: case 14:
ChangeAnimationDirection("Event Actor", STOPPED);
animpos = 4;
break;
case 3:ChangeAnimation("Event Actor", "Up", NO_CHANGE);
break;
case 5:ChangeAnimation("Event Actor", "Left", NO_CHANGE);
break;
case 7:ChangeAnimation("Event Actor", "Down", NO_CHANGE);
break;
case 9:ChangeAnimation("Event Actor", "Right", NO_CHANGE);
break;
}


Again, that's just me hating long codes. It doesn't work EXACTLY like how you had it before (in the since of holding keys it will go diagonal, easy fix if it bugs you a lot. And when the player runs into a wall he doesn't stop animating, also easy fix if it bugs you.) But I was just showing you my way since, well I'm not sure. I just like blabbing I guess! :)

EDIT: That post seems a bit snooty, don't change your code because of me :lol: I was just being an example





Jimmy, can you explain how to have 4 way movement?
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: RPG movement System 2

Postby jimmynewguy » Sat Sep 24, 2011 2:01 am

Sure, should've just used it originally since it fixes that bug you found.

Just get rid of all the bods draw actor and keep the collision physical response, then for the player's draw actor do this
Code: Select all
char *key=GetKeyState();
int dir = (3*key[KEY_UP]+5*key[KEY_LEFT]+7*key[KEY_DOWN]+9*key[KEY_RIGHT]);// Make direction

if(key[KEY_LEFT]+key[KEY_RIGHT]+key[KEY_UP]+key[KEY_DOWN] == 1)// if only one of our keys is pressed
{
BOD.x += 2*(key[KEY_RIGHT]-key[KEY_LEFT]);// movex
BOD.y += 2*(key[KEY_DOWN]-key[KEY_UP]);// movey

ChangeAnimationDirection("Event Actor", FORWARD);// animate
switch(dir)
{
case 3:ChangeAnimation("Event Actor", "Up", NO_CHANGE);
break;
case 5:ChangeAnimation("Event Actor", "Left", NO_CHANGE);
break;
case 7:ChangeAnimation("Event Actor", "Down", NO_CHANGE);
break;
case 9:ChangeAnimation("Event Actor", "Right", NO_CHANGE);
break;
}
}
else
{
ChangeAnimationDirection("Event Actor", STOPPED);// don't animate
animpos = 4;
}

Just say if it doesn't make sense :wink:
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: RPG movement System 2

Postby Hblade » Mon Sep 26, 2011 2:41 pm

Thanks jimmy! :)

EDIT: But now he stops when your going up and you press over xD Is there any way to make him move left instead of stop? (For example)

Holding up then pressing left would make the player go left, then vise versa, holding left and pressing up would make the player go up (Kinda like RPG maker style :) )
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to Game Demos

Who is online

Users browsing this forum: No registered users and 1 guest