This site requires JavaScript, please enable it in your browser!
Greenfoot back
Unlimited
Unlimited wrote ...

2018/12/26

Game Creation: Directional Idle, Shooting and Jumping.

1
2
3
4
5
6
7
Unlimited Unlimited

2018/12/27

#
ok but still having the setlocation error
danpost danpost

2018/12/27

#
Unlimited wrote...
Im getting two errors, one at xSpeed (i asume you meant vSpeed?) and one at Set location.
Okay, insert the following as the first line in the horizontalMovement method:
int boost = Greenfoot.isKeyDown("s") ? 9 : 0;
Then change 'xSpeed' to '6+boost'.
Unlimited Unlimited

2018/12/27

#
Alright. Though i still cannot compile.
danpost danpost

2018/12/27

#
'6+boost' should be in parenthesis -- '(6+boost)'.
Unlimited wrote...
Alright. Though i still cannot compile.
Where are your red indicators?
Unlimited Unlimited

2018/12/27

#
The red indicators are at both setlocations in the horizontal movement method.
danpost danpost

2018/12/27

#
Unlimited wrote...
The red indicators are at both setlocations in the horizontal movement method.
They are both missing the second parameter ', getY()'.
Unlimited Unlimited

2018/12/27

#
Ok i compiled now, the animations seem to work however now when i press left or right the ground disappears and my character falls down and when i only run the game my border object (its just a wall really) dissapears as well.
Unlimited Unlimited

2018/12/27

#
Also is there a way to skip the first frame after it was played in the beginning since that is a startup animation, like it was before. if not ill just remove it.
Unlimited Unlimited

2018/12/27

#
Next thing is, what do i need to add to create the idle left animation?
else if (dir == 0 && animSet != standleftAnim) setAnim(standleftAnim, 2);
ive tried putting this into the method but then he just switches sides ever frame.
danpost danpost

2018/12/27

#
Unlimited wrote...
Also is there a way to skip the first frame after it was played in the beginning since that is a startup animation, like it was before. if not ill just remove it.
Set that as the default image of the class and remove it from the array.
Unlimited Unlimited

2018/12/27

#
Uh and how do i do that? Also shooting animation is the same issue i think since thats also directional and i want to be able to shoot standing and moving and have a different animation. Next thing is, do you know why my character is teleporting up and down?
Unlimited Unlimited

2018/12/27

#
But ok i need to focus, one thing at the time. So the default.
danpost danpost

2018/12/27

#
Unlimited wrote...
what do i need to add to create the idle left animation? << Code Omitted >> ive tried putting this into the method but then he just switches sides ever frame.
Putting it into a method is not going to change much. Try replacing the '// image' code with the following:
if (dir == -1 && animSet != leftAnim) setAnim(leftAnim, 6);
else if (dir == 1 && animSet != rightAnim) setAnim(rightAnim, 6);
else if (dir == 0 && animSet != standLeftAnim && animSet != standRightAnim) setAnim(animSet == leftAnim ? standLeftAnim : standRightAnim, 2);
Unlimited Unlimited

2018/12/27

#
Im getting errors at the standLeftAnim.
danpost danpost

2018/12/27

#
Unlimited wrote...
Im getting errors at the standLeftAnim.
What does it say about the error? (hover mouse over red indicator) Wait -- it should be 'standleftAnim' (with a lowercase 'left')
There are more replies on the next page.
1
2
3
4
5
6
7