Platformer Example

About Monkey 2 Forums Monkey 2 Code Library Platformer Example

This topic contains 7 replies, has 5 voices, and was last updated by  Skaruts 5 months, 1 week ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #13290

    Amon
    Participant
    #13299

    therevills
    Participant

    Nice little example Amon 🙂

    It runs too fast on my PC, so I needed to add a timer to slow it down.

    And by doing so you can see a little bug which sometimes makes “Dave” float upwards…

    #13312

    Amon
    Participant

    Heya, Cheers. 🙂

    Ahh, that’s a silly bug. Fixed, I think. Change the code below by adding a canJump = 0 after isFalling = 1.

    New code

    #13336

    Pakz
    Participant

    Nice. The movement feels good.

    I think I now also figured out how to use assets. I have not used those before in Monkey2.

    #13347

    therevills
    Participant

    @pakz I cheat, put everything in an assests folder and just use:

    Which will copy over all the assets 🙂

    #14842

    Skaruts
    Participant

    Is there a way to render a portion of an image without having to create new ones, as you do in the LoadSpriteSheet function?

    imgs[i] = New Image( atlasImg, New Recti( x , y, x + cellWidth, y + cellHeight ) )

    #14845

    Mark Sibly
    Keymaster

    Is there a way to render a portion of an image without having to create new ones, as you do in the LoadSpriteSheet function?

    There are versions of Canvas.DrawRect that have a source image parameter, eg:  DrawRect( x,y,w,h,srcimage:Image,srcx,srcy,srcw,srch )

    #14846

    Skaruts
    Participant

    Which way do you think would be faster?

    Because now that I’m thinking about it, I suppose the amount of draw calls will be the same.

    (I would use this for a terminal emulator, for a classical roguelike.)

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.