1. Are you ready for the Galaxy S20? Here is everything we know so far!

HAC demo lunar lander

Discussion in 'Android Development' started by Malkoma, Sep 22, 2011.

  1. Malkoma

    Malkoma Newbie
    Thread Starter

    HyperNext Android Creator is an easy to use software creation system that allows almost anyone to quickly start building their own Android apps that work. With HAC there is no need to learn Java or the Android SDK and it is much easier to use than Eclipse or Netbeans.

    The latest update to HAC introduces a sprite surface allowing easy creation of sprite type games. New projects include a basic Lunar Lander game and Aquarium sprite demo. There are also extra screen commands and the ability to direct some graphics commands to the sprite surface. This update has focused on improving the graphics speed on both low-end Android devices and emulators. The memory system and interrupts have also been improved so making apps even more responsive when in front and very low lag when in the background.

    In all there are 47 new commands and functions covering sprite animation, screen canvas and network.

    HAC has also received a number of improvements including the option to make controls invisible at startup. The About Box and Splash Screen designers have been removed as the Home card is the natural place for having a Splash Screen or About Box.

    A free trial of HAC is available on our website that can build then run apps on both Emulator and Android devices. It has full functionality except apps can only be signed by the debug key and they time out after a few minutes.

    Visitors can also download some demo apps including Lunar Lander straight onto their Android device. Each demo also has a description and screenshot.

    (TigaByte Software)

  2. Georgiac

    Georgiac Lurker

    I was looking for code examples of modding Lunar Lander and saw this post but most of it is about HAC and absolutely no description of what makes this Lunar Lander different from all the others out there.

    I'm not sure, but does it use sprites or does the user just draw a bitmap to a canvas as in the standard Java Lunar Landers? if it is really sprites then that would be cool and save a lot of work in writing more complex games. With no code to help judge this its disappointing - guess I'll have to Google this HAC stuff as there are no web links either.
  3. Malkoma

    Malkoma Newbie
    Thread Starter

    Sorry for the missing code. I'll put some below, enough to give an idea how this version of Lunar Lander works. There is a full project on our website but it needs HAC installing in order to examine the code.

    Yes it does use a sprite for the ship and this is drawn on an animation surface. A canvas could have been used and an image of the ship drawn on it but as you say sprites do offer some advantages such as handling occlusion etc.

    Here is some code for Lunar Lander that I posted in some other forums a few days ago. Its not the complete code because some is in buttons and other controls plus initialisation code not shown here.

    The Animation event is equivalent in some ways to a Game-Loop. It fires every 30mS or whatever is specified when the Animation is setup.

    Code (Text):
    1. ++++++++++ AnimationEvent ++++++++++++
    3. Global gameOverFlag
    4. Global spriteID,shipPlain,firingFrames
    5. Global shipX,shipY,deltaX,deltaY
    6. Global pullGravity
    7. Local okay
    9. if gameOverFlag=1 then
    10.     AnimationStop
    11.     GotoLabel 1
    12. Endif
    14. @ gravity
    15. Add pullGravity to deltaY
    17. if fuelNow>0 then
    18.     Call KeyAction
    19. EndIf
    21. Call DrawSpeedGauge
    23. if firingFrames>0 then
    24.     Decrement firingFrames
    25. else
    26.     SpriteFetchBank(spriteID,shipPlain)
    27. endif
    29. Add deltaX to shipX
    30. Add deltaY to shipY
    32. SpriteSetCoords(spriteID,shipX,shipY)
    35. if (shipX<10) OR (shipX>275) OR (shipY>275) then
    36.        Call GameOver
    37. endif
    39. @ +++ Tell to update canvas draws +++
    40. AnimationEndFrame
    42. label 1

    Code (Text):
    1. ++++++++++++ KeyAction() +++++++++++++
    3. Local kval
    5. @ Up trackerball center
    6. Put SpriteKeyTestFN(11) into kval
    7. @DebugMessage('Animation',kval)
    8. if kval=1 then
    9.     Call EngineFire(1)
    10.     GotoLabel 1
    11. endif
    13. @ Up trackerball
    14. Put SpriteKeyTestFN(126) into kval
    15. @DebugMessage('Animation',kval)
    16. if kval=1 then
    17.     Call EngineFire(1)
    18.     GotoLabel 1
    19. endif
    21. @ Left trackerball
    22. Put SpriteKeyTestFN(123) into kval
    23. @DebugMessage('Animation',kval)
    24. if kval=1 then
    25.     Call EngineFire(2)
    26.     GotoLabel 1
    27. endif
    29. @ Right
    30. Put SpriteKeyTestFN(124) into kval
    31. @DebugMessage('Animation',kval)
    32. if kval=1 then
    33.     Call EngineFire(3)
    34.     GotoLabel 1
    35. endif
    38. label 1

    Code (Text):
    1. +++++++++++ EngineFire(direction) +++++++++++
    3. @ direction:- 1 up, 2 left, 3 right
    4. Global fuelNow,deltaX,deltaY
    5. Global pushUp,pushSide
    6. Global spriteID,shipFiring,firingFrames
    8. Local direct,res
    10. Subtract 10 from fuelNow
    11. Call DrawFuelGauge
    14. Put direction  into direct
    16. if direct=1 then
    17.     Subtract pushUp from deltaY
    18. else
    19.         if direct=2 then
    20.             Subtract pushSide from deltaX
    21.         else
    22.             Add pushSide to deltaX
    23.         endif
    24. endif
    26. Put 5 into firingFrames
    28. SpriteFetchBank(spriteID,shipFiring)
  4. Malkoma

    Malkoma Newbie
    Thread Starter

    Just to make the clearer about the demos. The demos are simple .apk files and are on our Projects web page. Just go to there using your Android's web browser and touch the green arrow next to the app/game you want to try out. The blue info graphics gives a screenshot of the app/game.

Share This Page