none
Small basic platform game crash RRS feed

  • Question

  • someone help me please!

    I wrote a code it worked but I don't want to flying ball and falling start!

    there is import id:NXR647

    Saturday, May 31, 2014 9:56 AM

Answers

All replies

  • Hi POSB

    Does this help?    Add X = X + 1

    Sub Jump
      If dY = 0 And Y = GraphicsWindow.Height - diameter Then
        dY = powerBurst
      EndIf
      
      dY = dY - t
      X = X + 1     ' <<<<<add this
      
      If dY = -powerBurst+hj Then
        dY = 0
        jumping = "False"
      EndIf
    EndSub

    Saturday, May 31, 2014 10:33 AM
    Moderator
  • so so but not enough 

    Thanks Jibba

    Saturday, May 31, 2014 11:18 AM
  • In OnKeyDown, do you need "If X>96 Then"?

    At the start, ball X=25.


    Nonki Takahashi

    Monday, June 2, 2014 3:09 PM
    Moderator
  • no I don't need it

    if you want you can change it please

    Monday, June 2, 2014 6:59 PM
  • no I don't need it

    if you want you can change it please


    OK, please refer NXR647-0.  I added comments like 'Nonki on lines I changed.

    Nonki Takahashi

    Tuesday, June 3, 2014 2:39 AM
    Moderator
  • nice work nonki but it is still flying when it is on the end of the box
    Tuesday, June 3, 2014 2:28 PM
  • ProfessionalOfSmallBasic,

    Why is your ball still flying on the end of the box?

    I rewrote your program for readability.  See NXR647-1.  I changed variable names as follows:

    • array z to xhole
    • variable b to yhole
    • array k to xbox
    • variable l to ybox

    And I think comparisons at a hole and at a box will be different.

    Screen shot of a program Small basic platform game 

    About left edge, if xhole[i] <= x then ball goes down.  If xbox[i] <= x - 12.5 then ball is on the box.


    Nonki Takahashi



    Monday, June 9, 2014 6:01 AM
    Moderator
  • I don't know but I want to the ball will fell down when it is on the end of the box,too.

    if you can fix that I will so happy 

    Thanks Nonki.

    Wednesday, June 11, 2014 11:57 AM
  • I don't know but I want to the ball will fell down when it is on the end of the box,too.

    You should do something like this:

    bottom=425   (top asd - diameter)

    if over a hole    bottom=500  (or other big value)

    if over a box    bottom=375

    if y<bottom    dy=some positive value

    if y=bottom   dy=0

    y=y+dy

    #####  some other remarks about your program:

    Why do you put something on the stack and later remove it?

    You fill e.g. 7 boxes in a array with 42 members, and then have to scan from 1 to 42. Better to use an array with 7 menbers.

    If you place the generation of the ball-shape after all the other shapes, the ball moves in front of them (e.g. hole background) Shapes are stacked in the order of generation, the last one is in the front.


    Jan [ WhTurner ] The Netherlands



    Thursday, June 12, 2014 9:25 AM
    Answerer
  • thanks WhTurner33,

    But I want to see some code about it, I didn't understand enough.

    Thursday, June 12, 2014 11:02 AM
  • I added something in holes and how I make the finish?

    import id:NXR647-2

    Thursday, June 12, 2014 11:26 AM
  • I added something in holes and how I make the finish?

    import id:NXR647-2

    I rewrote your program as NRX647-3.  But I couldn't understand your rule to control Y in your program.   When I make this kind of program I use physics to control Y.  So for jump, I add some velocity to a ball then ball start jumping and after dt (delta time), gravity slows down the ball velocity.  But your program doesn't use physics.  So you should think your own rule in spite of physics.  I can't understand what you'd like to do.

    Y is control by -dY (jumping) and +4 (in Subroutine control).  But with physics, dY is only one --- that is velocity * dt.


    Nonki Takahashi

    Thursday, June 12, 2014 3:15 PM
    Moderator
  • I take a jump event and it isn't me,so I added something and boom! İt is now like this.
    Thursday, June 12, 2014 4:16 PM
  • Part of the issue is that what you want to is quite tricky and there are no simple answers.  We can't modify a few lines in your code and make it work.

    You want the player to bounce of floors and walls and fall through holes.  This needs to be coded.

    The following is a sample I have that does this kind of thing - there are several ways it could be done.  Probably the easiest is actually to use LDPhysics in LitDev extension, but here is a sample without extensions.

    Import GQK086 - not simple code, but what you want to do is not so simple!

    Saturday, June 14, 2014 7:10 PM
    Moderator
  • Thanks LitDev,

    Now, I am learning how to use LDphysics.

    Saturday, June 14, 2014 8:18 PM
  • Nonki can you give me a physical jumping sample?(with velocity, dt and dy)
    Sunday, June 15, 2014 2:31 PM
  • ProfessionalOfSmallBasic,

    How about Mario_Motion in FGM769-7?

    Or Man_Throw in TKL110-4?


    Nonki Takahashi


    Thursday, June 19, 2014 9:52 AM
    Moderator