Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

998803 Posts in 39178 Topics- by 30591 Members - Latest Member: gerardrallo

April 21, 2014, 01:38:30 AM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Princess Peach Floaty jump?
Pages: [1]
Print
Author Topic: Princess Peach Floaty jump?  (Read 454 times)
siskavard
Level 10
*****


FUTUREBEARD


View Profile WWW Email
« on: March 14, 2013, 03:06:25 PM »

Hey guys, I'm trying to get the guy in my platformer to do a Princess Peach from SMB2 style hover-jump. I've got the hover part working (sort of) & now I'm trying to get the hover to STOP after a second or so. My first thought was to use alarm events & I've been trying to understand how to make those work, but I'm curious if anyone has any better ways to do this? I've hit a brick wall on this.

I know it's a bit vague without seeing my code, I just didn't want to splash half a page with it.

Appreciate any help!

Logged

pgil
Guest
« Reply #1 on: March 14, 2013, 03:12:29 PM »

an alarm will work.

You could also just set a variable that counts down each step while you're hovering, and if it's under zero, then the hovering stops.

Code:
if (starting jump) {
  hover_time = 20;
}

if (hover_time > 0) {
  //do whatever makes you hover, like set vertical speed
  hover_time -=1;
}
Logged
ஒழுக்கின்மை
Level 10
*****


Also known as रिंकू.

RinkuHero
View Profile WWW Email
« Reply #2 on: March 14, 2013, 04:12:27 PM »

yep, alarms or decrementing variables are the way to do this; those two things are actually identical, it's just that one is done with drag and drop events and the other done with code.
Logged

siskavard
Level 10
*****


FUTUREBEARD


View Profile WWW Email
« Reply #3 on: March 14, 2013, 04:28:24 PM »

Awesome. I'm forcefully bashing my brains in with GML, as I know the D&D elements aren't usually optimal.

One of my attempts to get this working was to make a hover variable, but just making variables is new to me, so nothing I was trying was working. I'll give what you suggested a shot tonight, pgil.

More than likely, I'll report back here with more questions. I know that the way Peach jumps is actually a bit complex. Right now I"m just trying to nail down the hover time.

Cheers guys!
 Toast Right
Logged

siskavard
Level 10
*****


FUTUREBEARD


View Profile WWW Email
« Reply #4 on: March 17, 2013, 10:30:49 AM »

So I didn't have much success with the alarms, I did everything correct, but I think there must be something in my code that is interfering. I did however, with tons of gracious help from MattFitz, get the float to work via counting down type variables.


So I figure the next thing I want to tackle is the up and down bobbing motion, while the player is hovering. What do you guys think is the best way to tackle this? I'm already trying some things, but not much success.

Tanks
Logged

John Sandoval
Cpt. Dum
Global Moderator
Level 10
******


get mad


View Profile WWW
« Reply #5 on: March 17, 2013, 10:49:13 AM »

theres a couple ways to do this but the easiest is to just animate the floating sprite up and down
Logged

siskavard
Level 10
*****


FUTUREBEARD


View Profile WWW Email
« Reply #6 on: March 17, 2013, 11:13:14 AM »

theres a couple ways to do this but the easiest is to just animate the floating sprite up and down

oh, I hadnt even thought about that. awesome
Logged

base64
Level 7
**


grope


View Profile WWW
« Reply #7 on: March 17, 2013, 12:42:49 PM »

this could make for a smooth bobbing effect.  I haven't tested it though.

var true_y = self.y - (sin(360/(hover_time-1))*10)
self.y = true_y + (sin(360/hover_time)*10)

true_y is the y position without any bobbing added (which is added by the previous call).

hover_time is the current time of hovering.

to adjust bobbing amount, change 10 to a value between 1-10.
« Last Edit: March 17, 2013, 12:51:16 PM by softchange » Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic