• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps HAC demo lunar lander

Malkoma

Newbie
Aug 20, 2010
11
0
UK
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.

Malkom
(TigaByte Software)
 
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.
 
Upvote 0
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.

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.


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.

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:
++++++++++ AnimationEvent ++++++++++++

Global gameOverFlag
Global spriteID,shipPlain,firingFrames
Global shipX,shipY,deltaX,deltaY
Global pullGravity
Local okay

if gameOverFlag=1 then
    AnimationStop
    GotoLabel 1
Endif

@ gravity
Add pullGravity to deltaY

if fuelNow>0 then
    Call KeyAction
EndIf

Call DrawSpeedGauge

if firingFrames>0 then
    Decrement firingFrames
else
    SpriteFetchBank(spriteID,shipPlain)
endif

Add deltaX to shipX
Add deltaY to shipY

SpriteSetCoords(spriteID,shipX,shipY)


if (shipX<10) OR (shipX>275) OR (shipY>275) then
       Call GameOver
endif

@ +++ Tell to update canvas draws +++
AnimationEndFrame

label 1


Code:
++++++++++++ KeyAction() +++++++++++++

Local kval

@ Up trackerball center
Put SpriteKeyTestFN(11) into kval
@DebugMessage('Animation',kval)
if kval=1 then
    Call EngineFire(1)
    GotoLabel 1
endif

@ Up trackerball
Put SpriteKeyTestFN(126) into kval
@DebugMessage('Animation',kval)
if kval=1 then
    Call EngineFire(1)
    GotoLabel 1
endif

@ Left trackerball
Put SpriteKeyTestFN(123) into kval
@DebugMessage('Animation',kval)
if kval=1 then
    Call EngineFire(2)
    GotoLabel 1
endif

@ Right
Put SpriteKeyTestFN(124) into kval
@DebugMessage('Animation',kval)
if kval=1 then
    Call EngineFire(3)
    GotoLabel 1
endif
    

label 1



Code:
+++++++++++ EngineFire(direction) +++++++++++

@ direction:- 1 up, 2 left, 3 right
Global fuelNow,deltaX,deltaY
Global pushUp,pushSide
Global spriteID,shipFiring,firingFrames

Local direct,res

Subtract 10 from fuelNow
Call DrawFuelGauge


Put direction  into direct

if direct=1 then
    Subtract pushUp from deltaY
else
        if direct=2 then
            Subtract pushSide from deltaX
        else
            Add pushSide to deltaX
        endif
endif

Put 5 into firingFrames

SpriteFetchBank(spriteID,shipFiring)
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones