How can a filled region control the y velocity of a normal actor? I cannot figure this out and help would be greatly appreciated.
player.yvelocity = -15;
JetpackGrizzly wrote:Okay, and what way could I make this possible for an infinite jump?
JetpackGrizzly wrote:How can I make the filled region act as the space bar, or work exactly like it? (If I hold in the space bar the actor continues to rise, but for a click it does not.)
skydereign wrote:JetpackGrizzly wrote:How can I make the filled region act as the space bar, or work exactly like it? (If I hold in the space bar the actor continues to rise, but for a click it does not.)
What you need is a variable stating if the actor is clicked or not. You can make one that does that by setting it to 1 when the button is clicked, and setting it to 0 when it is released. That's just a matter of having a mouse button down and mouse button up event. With that, you can put in the button's draw actor the jump code.
Another alternative is to put the code in the player's draw actor, that way you don't have to change any of the "Event Actor" and yvelocity calls from your space bar event. You just need to make sure you are checking the variable.
JetpackGrizzly wrote: it will act as a space bar being pressed without actually physically needing a space bar?
if(jump_button_pressed==1)
{
// your code that was originally in the space key down event goes here
}
skydereign wrote:Make sure to change the correct actor's animation Normally it is "Event Actor", so you need to change that to "player" or whatever your player actor's name is. If you did do that, then the problem is that your player code is updating the animation when you don't want it to, and we'll need to see more code to be able to help with that.
touch = 1;
switch(currenttexture)
{
case 0:
switch(state)
{
case 0:
ChangeAnimation("Jumper", "charRight", FORWARD);
break;
case 1:
ChangeAnimation("Jumper", "flyingg", FORWARD);
break;
}
break;
case 1:
switch(state)
{
case 3:
ChangeAnimation("Jumper", "flyingp", FORWARD);
break;
case 2:
ChangeAnimation("Jumper", "runningp", FORWARD);
break;
}
break;
case 2:
switch(state)
{
case 4:
ChangeAnimation("Jumper", "runningpanda", FORWARD);
break;
case 5:
ChangeAnimation("Jumper", "flyingpanda", FORWARD);
break;
}
}
switch(touch)
{
case 0:
yvelocity = yvelocity + .7;
break;
case 1:
yvelocity = -6.5;
break;
}
JetpackGrizzly wrote:
- Code: Select all
switch(touch)
{
case 0:
yvelocity = yvelocity + .7;
break;
case 1:
yvelocity = -6.5;
break;
}
Users browsing this forum: No registered users and 1 guest