woflcub Posted September 10, 2010 Report Share Posted September 10, 2010 Im trying to make sonic go into a ball then do the speed boost i made. Is there anyway i could do that because on the 3D game hes in a ball after that he begins to run i wanna do that on my fangame but in 2D please help? heres a video on what im talking about. http://www.youtube.com/watch?v=COezkuPMvzE Link to comment Share on other sites More sharing options...
DimensionWarped Posted September 10, 2010 Report Share Posted September 10, 2010 I'm sorry young waffle, but I'm not exactly sure what you are wanting. Could you please describe the action in terms of something like how I'd describe the spin dash? IE: The player's character is in the crouching animation The player presses the action button for jump and goes into the spindash start pose In the spindash start pose, the player can press the action button for jump to add power to the spindash. Power gradually decreases at all times. The player can then release the down button in order to go instantly into the roll animation with speed based on the power of the spindash. Link to comment Share on other sites More sharing options...
woflcub Posted September 10, 2010 Author Report Share Posted September 10, 2010 what i mean is when hes doing the boost he just runs what i want him to do is this boost http://www.youtube.com/watch?v=9UfREHgyh20 compare that with this http://www.youtube.com/watch?v=COezkuPMvzE this is the problem im having and i can't make a homing attack either sadly xD but thats what i mean lol. Link to comment Share on other sites More sharing options...
DimensionWarped Posted September 10, 2010 Report Share Posted September 10, 2010 Ok, so basically you just want the following: Push a button while moving or in whatever state. Player character rolls into a ball. After something like a quarter of a second, player character unrolls going at such and such speed until the button is pressed again. Or am I mistaken? Anyway, as for how you'd go about this, this is largely going to depend on your engine. Are you using a specific engine that any of us would be familiar with or is it a home-grown engine of your own design? Also, what program are you using if it's something like MMF/GM or did you program it from the ground up? Link to comment Share on other sites More sharing options...
woflcub Posted September 10, 2010 Author Report Share Posted September 10, 2010 Its From Gamemaker 8 and i made it myself xD i just need these 2 things so i can start working on other things lol these 2 things is what is holding me back.... and yes thats what im talking about lol Link to comment Share on other sites More sharing options...
DimensionWarped Posted September 10, 2010 Report Share Posted September 10, 2010 Well, since you made it yourself and since you are, I'm guessing, a beginner... that means things are probably going to be messy... since you aren't likely using any kind of action control type thing such as a state machine. Since that's the case, I guess just for the purpose of learning, you could have a variable that you turn on (set to 1) when you push the button if it's off (set to 0) and that variable could represent whether or not the boost is activated. Once it's activated, if the player could start the boost animation which would basically just be a short roll for the first 6 frames or so and then turn into a regular fast running animation for the next however many frames and loops back to the beginning of the running phase. If it's on and the frames are beyond the first however many that are used for the roll portion of the animation, set the speed higher than it is otherwise. If he pushes the button again, put him back in the regular fast running animation and turn the variable back to off. You could do it cleaner though if you had an engine that allowed you to have a so called 'boost state' which uniquely puts the character in boost mode rather than having it be it's own thing. Link to comment Share on other sites More sharing options...
woflcub Posted September 10, 2010 Author Report Share Posted September 10, 2010 Do You know anything about a homing attack by chance? Link to comment Share on other sites More sharing options...
DimensionWarped Posted September 11, 2010 Report Share Posted September 11, 2010 Yes. I know that the big challenge isn't actually the motion of the homing attack itself, but the heuristic for selecting a target. Link to comment Share on other sites More sharing options...
woflcub Posted September 11, 2010 Author Report Share Posted September 11, 2010 oh so you mean making the homing attack is easy but making sonic choose the right target to hit is hard right? Link to comment Share on other sites More sharing options...
DimensionWarped Posted September 11, 2010 Report Share Posted September 11, 2010 Yep Link to comment Share on other sites More sharing options...
woflcub Posted September 11, 2010 Author Report Share Posted September 11, 2010 Lol well that makes since xD. Preety much i put a parent on the enemies so i would make him go to the closest enemy with the parent on, but im not close to that lol. Do you know a homing attack code i could work on or something so i can see how it works and analyze it to make my own? Link to comment Share on other sites More sharing options...
DimensionWarped Posted September 11, 2010 Report Share Posted September 11, 2010 Well you know, depending on your engine the implementation of your homing attack can be pretty varied. Usually I'd have a homing attack state where I'd have the target point defined and the starting point being the player's position at the beginning of it and then I'd use some cheeky formula to make an arc, probably starting with a slope of zero. From there I'd simply follow the arc with a specific arc length delta each frame. Or maybe I'd approximate it by just going so far along the x if calculating arc length ended up being an issue. But I have to stress that everyone does it differently and there is no real 'wrong' way of doing it... unless you know, it doesn't hit the target. And even that's right if you consider the source material. ZING! Link to comment Share on other sites More sharing options...
woflcub Posted September 11, 2010 Author Report Share Posted September 11, 2010 Lolz hmmm what if i put this if action_jump is equal to true and homing =1 chase nearest instance (Enemy's Parent) else if action_jump is equal to false and homing= 0 action=action_normal would that help? Link to comment Share on other sites More sharing options...
DimensionWarped Posted September 11, 2010 Report Share Posted September 11, 2010 I guess that's kind of following the whole action/state concept, but at the same time by having them in separate variables makes it very error prone. A better way to handle your actions is to use an action state value which would represent something based on what it's set to. Like for instance: 0 - normal movement 1 - jump 2 - homing attack 3 - speed break And then your events for controlling motion can use the variable of the action state in consideration. This way your actions are less error prone in general because only one state can be active at a time no matter what kind of mistake you make programming. 1 Link to comment Share on other sites More sharing options...
woflcub Posted September 11, 2010 Author Report Share Posted September 11, 2010 lol my settings are action = 0; action_normal = 0; action_jump = 1; action_homing = 8; xD including the other actions lolz Link to comment Share on other sites More sharing options...
woflcub Posted September 14, 2010 Author Report Share Posted September 14, 2010 This is my code for the homing attack this is for the space event if keyboard_check_pressed(vk_space) then homing=true if distance_to_object(obj_Badnik_Par) >1{ } move_towards_point(obj_Badnik_Par.x,obj_Badnik_Par.y,speed) Link to comment Share on other sites More sharing options...
Recommended Posts