The Daily Click ::. Forums ::. Klik Coding Help ::. New + Need some help.
 

Post Reply  Post Oekaki 
 

Posted By Message

DakaSha



Registered
  21/10/2008
Points
  32
21st October, 2008 at 20:35:14 -

Hey first off glad i found this site. been wanting to create games for the past 13 years but never had the patience/drive for true programming. now i finally got MMF2 and am ecstatic.

ok enough of that.

Ive been playing with this for the past 4 days and ive learned quite a bit but i can tell there are some things that are harder to do than one might think.

for instance:
platform movement with moving platforms (using vector movement for the platforms and the platform movement object that comes with the extension packs)

im sure alot of people have this problem but i cant find anything. i get problems i assume are typical for newbies like the dreaded collision detection (invented in hell im sure).

i can solve problems pretty well... only they create more problems... ill solve my player jumping into the middle of a platform moving down only to make it impossible to stand on when its moving up and so on... lots of variations of my problems

is there a basic approach to platform games that use moving platforms that can go in all possible directions?
also im a perfectionist when it comes to this so a clean solution would be nice

anyways whether i recieve any help or not thanks for readin my newb post ^^









 
n/a

Lönnemyr



Registered
  30/06/2008
Points
  69
21st October, 2008 at 21:49:17 -

First of all, welcome!

I`m pretty new myself and I recently got myself mmf2, and I´ve been playing around with it for a while trying to learn how to use it since I`ve been using tgf. To get some deeper understanding of this new program I`m building a platform engine, AND (dig this), I need help with exactly the same thing you do. Coinsidence indeed. I`m also using the platform movement object and somehow I got most things to work, I would`t claim I´ve a clean code though since most solutions I made up myself and there is probably better ways to do it.

So far I´ve done; sprint/run and doubble jump which both require stanima (I`ve set up a counter for that). I`ve also made it so the player character can put away or ready his weapon. Now there is two things left (probably more, but two important features), one being moving platforms, it is something I really want, especially lifts/elevators. And then there is the possibility to aim and shoot, in the same way it`s done in the worms games.

Just wanted to point out that there is more than one person who needs help with this. I`ve downloaded a tutorial from the clickteams homepage about platform movement, it is supposed to have moving platforms but I´ve not looked at it yet since I`m working on the "aim" feature. And I`m pretty sure I read that it requires fastloops, something I dont know anything about. I`ll give you a link to the tutorial I mentioned but personally I would like to konw if it can be done without fastloops.

http://www.clickteam.com/eng/resources/fastloop_plattutorial.zip

 
-

DakaSha



Registered
  21/10/2008
Points
  32
21st October, 2008 at 22:42:53 -

i could help you with aiming like in the worms games. in fact i coded something like that on the first day. do you want to use the mouse to aim or pressing up and down?
explain how u want it done and i can most likely code it for you.

fast loops are simple. although i think im missing times that one should use them (meaning that the usage is simple but not necessarily the time of usage )

ok ima check that tut now

 
n/a

DakaSha



Registered
  21/10/2008
Points
  32
22nd October, 2008 at 11:10:55 -

well i managed to get my little player dude to follow the rules of physics and not fall into solid walls.
my platforms also move (for now they can only move up, down, left and right without the collision screwing up but i think i can change that if i need it later). some little tiny annoyances but they are bearable and in any case can prob be fixed later (edit: fixed)

it looks really good and i think its pretty efficient too but im new so i might be wrong.

if u need help with platforms i might be able to help u depending on what ur doing. i could make perfectly functioning elevators like the ones from the lost vikings if im not overseeing some problem. and also the aiming like u said. i didnt use any loops.


now to get the platforms to interact with each other lol


Image Edited by the Author.

Image Edited by the Author.

 
n/a

Lönnemyr



Registered
  30/06/2008
Points
  69
22nd October, 2008 at 20:38:56 -

I want to be able to aim with the "up" and "down" arrow keys and keep the "aim" going in a smoth circle around the player. I would appreciate it if you could help me with this, if you know how it could be done. I heard that it could be done with the advanced math extention but math never was my strong subject in school and I could`t figure out how to use it . So far I`ve been trying to get it to work with X,Y values, counters, and all kind of complicated hockus pockus events.. without succes though.

Also if you have any idea on either how to animate the aiming feature (I don`t like the idea that I would have to do 180 different animations, there must be another way.. but im really tired and can`t think of any at the moment. Since it`s a platformer I can`t simply rotate the animation either), or how to make the bullets spread out a bit when the player is shooting (preventing a perfect aim) I would also greatly appreciate this too.
b
about the dreadful moving platforms, I want to learn how to make them move with the character on top, up, down, right and left.. ofc it would be interesting to know how to make them go in different directions as well but I might be able to figure that out myself. I`m building a platform enigine atm (not a game), but when I finish it i`ll probably make a short platformer for a friend of mine so he can learn how to do some stuff to. For that It would be cool with lifts like those in the lost vikings games for snes.

Thanks mate.

 
-

DakaSha



Registered
  21/10/2008
Points
  32
23rd October, 2008 at 00:05:09 -

ok here we go for the aim:

http://www.2shared.com/file/4143548/9fb24e62/aiming.html


prob not exactly what u want but it should be enough to get u where u want to be


ill do the elevators next

Image Edited by the Author.

 
n/a

DakaSha



Registered
  21/10/2008
Points
  32
23rd October, 2008 at 00:20:00 -

this is just a quickly modified version of the game im working on now.

http://www.2shared.com/file/4143615/9e3278c3/platforms.html

now i know this isnt exactly what ur looking for (the platforms always move when u press up whether on them or not for instance) but that should be really easy to change.

itll definitely get u where u need to be if u study how its done


ask if u need any help with these two examples

edit:i just noticed that the bullet comes outa the crosshair on the firing example instead of the muzzle flash object doesnt matter though as far as i can tell its the math part that got to you. also when u jump while using the platform in the 2nd example it kinda messes up... again should be easily solvable

Image Edited by the Author.

 
n/a

Fish20



Registered
  03/12/2007
Points
  263

VIP MemberPS3 OwnerI like Aliens!I'm a Storm TrooperIt's-a me, Mario!I am an April FoolPicture Me This Round 48 Winner!
23rd October, 2008 at 03:31:25 -

You shouldn't use rar files unless you absolutley need to, especialy for an incomplete game. The reason is because some people don't have winrar and can't extract and won't take the time to download it which means they won't download your game.

Btw welcome to tdc

Image Edited by the Author.

 
All your base are in another castle, take this.

DakaSha



Registered
  21/10/2008
Points
  32
23rd October, 2008 at 03:44:54 -

uhm hi...
its just an example for him to read off of and just about every single extractor can unzip rars... its the most widly used format on the internet...

 
n/a

Lönnemyr



Registered
  30/06/2008
Points
  69
23rd October, 2008 at 17:40:35 -

I use Winrar so it`s no prob. For some reason alot of people seems to be allergic to rar files on TDC but I`m not of those.

Thanks for taking your time DakaSha, I`ll download and look into it, and I´ll ask if there is any questionmarks.


[EDIT; I looked though both examples now, Thanks again DakaSha. I have a question though, what kind of "code" is MMF2 using and were can I learn it? Those examples was good but since I can`t understand the code/math I`ll not be knowing what I`m doing. Which might cause me trouble later on.]

Image Edited by the Author.

 
-

DakaSha



Registered
  21/10/2008
Points
  32
23rd October, 2008 at 21:47:51 -

well its just simple event management. its not really true programming. its a point and click version of script. you dont have to learn any programming u just have to understand the logic and the functions that the program offers you

"if (something happens or is true)

then (something happens/changes)"

thats all it is

ill go through the aiming example. load it and click on the event list editor (ctrl+L)

*Repeat while "Up Arrow" is pressed

Gun: Set angle to Angle("Gun") +1 Quality = 1


So every time Up is pressed (and held) the angle of the gun object is increased by 1 degree. The quality +1 is just a decision u get to make after entering the amount the angle changes.

*Repeat while "Down Arrow" is pressed

Gun: Set angle to Angle("Gun") -1 Quality = 1


same as above just so it rotates the other way.


*Always
Crosshair: Set Y position to: Y("Gun")-Sin(Angle("Gun"))*50
Crosshair: Set X position to: X("Gun")+Cos(Angle("Gun"))*50
Muzzle Flash: Set Y position to: Y("Gun")-Sin(Angle("Gun"))*26
Muzzle Flash: Set X position to: Y("Gun")+Cos(Angle("Gun"))*26

heh now its more complex but u need this kind of math when u want to make some stuff work. i personally never even took trigonometry but i did code in action script for awhile and so when i needed to know how to set objects relative to others (actually i used this math so i could make my character rotate towards the mouse which is an awesome control scheme) i googled how they do it and was able to read the code. also learned some math along the way ^^

anyways: the Crosshair is set in a position relative to the position and angle (the hard part) that the gun is currently in. this is calculated every time the program loops (always) so that it looks like it is done in real time. just in case you do not know "Y position" is the vertical position (in pixels) of an object (starting from up to down) and X is the horizontal (from left to right).

im not going to (and prob cant) explain the math ill just say: when doing this stuff just always look at the code i used and try to learn what it means... im not a teacher maybe read about trigonometry in wikipedia or maybe somebody can explain better. just use the code and replace the variables with what you need. it will eventually come to you ^^ mess with my example that i made you and see what happens this should help

ok:


* Upon pressing "Space Bar"
Start loop "fire" 1 times

*On loop "fire"
Muzzle Flash: Shoot "Bullet" at speed 100 toward (0,0) from "Crosshair"
Bullet: "set angle to Angle("Gun") Quality = 1


When u press the space bar u initiate the loop "fire".
"fire" then makes the "muzzle flash" object shoot a bullet at speed 100 towards the "crosshair" (exactly towards the crosshair...0,0)
and sets the angle of the bullet to the same angle of the gun (this is only important if your using a bullets that have length so that the graphic shoots out ion the right direction)

the reason we used a loop is because of changing the angle. if we had just changed the angle in the event of pressing space then every bullets angle would have been changed when space is pressed.

i made the bullet come ot of the muzzle flash so that it comes from right position. if it came dire4ctly from the gun it would look ugly


bleh i hope that makes it somewhat clearer. feel free to ask if you need any more help



Image Edited by the Author.

 
n/a

Lönnemyr



Registered
  30/06/2008
Points
  69
26th October, 2008 at 18:07:37 -

Ok, I got a couple of questions. First of, the event which sets the muzzle flash in front of the gun, isn`t it unnecessary complicated? Wouldn`t it better to just set guns action point were the "muzzle flash" will appear and then have a event which says;

Always - set position at (0,0) "muzzle flash" (action point)

I`ve tried both ways and I don`t see why the above event wouldn`t work just as good?

Besides that, what exactly does "Quality" do? I tried change the numer but nothing seems to change?

Also since my animation is an arm holding a gun, the aim will be a bit off (the aim is on the same level as the hand holding tha gun, not the gun barrel)if I use your formula. I take it that;

Crosshair: Set Y position to: Y("Gun")-Sin(Angle("Gun"))*50
Crosshair: Set X position to: X("Gun")+Cos(Angle("Gun"))*50

..Means that there will always be 50 pixels in between the crosshair and the gun, but if I want the crasshair to appear say 3 or 2 pixels "higher" then the gun arm, becuse that`s were the gun is, how do I do this?



I must say that the "angle" function is great btw, I thought it would tear up my "detailed" gun sprites but none of them look ugly in any direction..

 
-

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
26th October, 2008 at 19:06:43 -

Even easier way to do the aimer. Make your Crosshair, then put the hotspot off to the left about how far you want the aimer to be from your character.

Press up - Set angle of Aimer to Aimer.Angle + 1, quality=1

 
Craps, I'm an old man!

Lönnemyr



Registered
  30/06/2008
Points
  69
26th October, 2008 at 19:38:07 -

Knudde

And would that solution be stable? Becuse everywere you go on TDC everyone keeps saying that everything should be done with math since it`s better..


[EDIT; Besides, there would have to be extra events for when the character moves too, since the crosshair wouldn`t follow the player..]

Image Edited by the Author.

[EDIT; Tried your method Knudde, but the aim laggs behind and rotates in a weird way too. With the other math formula the aim didn`t rotate, it just changed position, which is better. ]

Image Edited by the Author.

 
-

DakaSha



Registered
  21/10/2008
Points
  32
26th October, 2008 at 21:23:54 -


Originally Posted by Lönnemyr
Ok, I got a couple of questions. First of, the event which sets the muzzle flash in front of the gun, isn`t it unnecessary complicated? Wouldn`t it better to just set guns action point were the "muzzle flash" will appear and then have a event which says;

Always - set position at (0,0) "muzzle flash" (action point)

I`ve tried both ways and I don`t see why the above event wouldn`t work just as good?



yeah i guess. i just tend not to do things that way in case i need the action point for something later on ^^ (as youll see )


Besides that, what exactly does "Quality" do? I tried change the numer but nothing seems to change?



im guessing youd notice a difference on large objects. maybe its better to just use 0 on small ones as im sure it slows things down which seem to be a problem in mmf. dont forget ive been using this for only a week


Also since my animation is an arm holding a gun, the aim will be a bit off (the aim is on the same level as the hand holding tha gun, not the gun barrel)if I use your formula. I take it that;

Crosshair: Set Y position to: Y("Gun")-Sin(Angle("Gun"))*50
Crosshair: Set X position to: X("Gun")+Cos(Angle("Gun"))*50

..Means that there will always be 50 pixels in between the crosshair and the gun, but if I want the crasshair to appear say 3 or 2 pixels "higher" then the gun arm, becuse that`s were the gun is, how do I do this?



set an action point at the "height" u want it and change the formula from Y"gun" and X"gun" to the action point u kinda answered this one yourself )




Image Edited by the Author.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click