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

2019/9/15

text box or image showing up when character goes on top of character

Bluetiger Bluetiger

2019/9/15

#
Hello I am trying to have the player walk up to a character(actor) and a text box or image will appear on top of the screen.
danpost danpost

2019/9/16

#
Bluetiger wrote...
Hello I am trying to have the player walk up to a character(actor) and a text box or image will appear on top of the screen.
What issue(s) are you having? What code have you tried?
Bluetiger Bluetiger

2019/9/16

#
Never mind I figured it out. Thank you anyways
Bluetiger Bluetiger

2019/9/16

#
Could I have help with some platforming? I cant seem to have two different platforms for my character to jump on.
public boolean onGround()
    {
        int spriteHeight = getImage().getHeight();
        int lookForGround = (int)(spriteHeight/2) + 5;
        
        Actor Ground = getOneObjectAtOffset(0, lookForGround, Platform.class); 
         
        
        if(Ground == null)
          {
            jumping= true;
            return false;
        }
        else
        {
            moveToGround(Ground);
            return true;
        }
        
    }
    
    public void moveToGround(Actor Ground)
    {
        int groundHeight = Ground.getImage().getHeight();
        int newY = Ground.getY() - (groundHeight + getImage().getHeight())/2;
        
        setLocation(getX(), newY);
        jumping = false;
    }
danpost danpost

2019/9/17

#
Bluetiger wrote...
Could I have help with some platforming? I cant seem to have two different platforms for my character to jump on. << Code Omitted >>
Not enough code is given to determine why you "cant seem to have two different platforms for (your) character to jump on. I am not a fan of using jumping field. I believe that since gravity is ever-present, "falling" (or vertical movement) should always happen and only after that should touching a platform (or ground) should be checked, which will then lead to the current on-ground (or platform) state.. The previous on-ground state is not relevant and does not need to be held from one act cycle to the next. Please see my Jump and Run Demo w/Moving Platform scenario.
Bluetiger Bluetiger

2019/9/17

#
danpost wrote...
Bluetiger wrote...
Could I have help with some platforming? I cant seem to have two different platforms for my character to jump on. << Code Omitted >>
Not enough code is given to determine why you "cant seem to have two different platforms for (your) character to jump on. I am not a fan of using jumping field. I believe that since gravity is ever-present, "falling" (or vertical movement) should always happen and only after that should touching a platform (or ground) should be checked, which will then lead to the current on-ground (or platform) state.. The previous on-ground state is not relevant and does not need to be held from one act cycle to the next. Please see my Jump and Run Demo w/Moving Platform scenario.
That game seems quite helpful. Is there anyway I could see the code for it?
danpost danpost

2019/9/17

#
Bluetiger wrote...
That game seems quite helpful. Is there anyway I could see the code for it?
Run the scenario. Click on buttons (ground platforms -- "Where", "What" and "Who" buttons).
You need to login to post a reply.