Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Need help with to create a dynamic fighting-system

Author
Message
WAKS
5
Years of Service
User Offline
Joined: 5th Oct 2013
Location: Oslo, Norway
Posted: 1st Nov 2013 15:04
Anyone who can help me to create a simple fighting-system that allow you to kick or punch the other player, and the player that being hit will be pushed back. I have tried to do it self with to create different hot spot, but the problem is that my game is so undynamic, and really static if someone could help me with to create or come with examples that would be nice.

Here is my game code



Thanks for help
WAKS
5
Years of Service
User Offline
Joined: 5th Oct 2013
Location: Oslo, Norway
Posted: 1st Nov 2013 15:10
Here is a picture from my game

Attachments

Login to view attachments
smerf
14
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 18th Jan 2014 01:06
not sure im following looks like u know how to code so im assuming ur not asking how to move a sprite backwards if a variable kick=1 right?

A child's dream never dies.
Van B
Moderator
16
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 19th Jan 2014 18:35
I think if you change your character left and right movement, you'll get better results. Like, rather than having it just move left or right by it's speed, have a variable for the speed, and reduce it each loop. Like...

XS#=XS#*0.9
inc XS#,(rightkey()-leftkey())*0.25
if XS#<-1.0 then XS#=-1.0
if XS#>1.0 then XS#=1.0

Now, when the player is kicked, you can just set XS# to and opposite direction, -1.0 or 1.0 - and they'll be knocked away. It would also make movement left and right more fluid, like in Mario for example with the inertia. Values can be tweaked until you have something that works.

I am the one who knocks...

Login to post a reply

Server time is: 2019-05-26 00:47:37
Your offset time is: 2019-05-26 00:47:37