Thread: Going APE?
View Single Post
Old 10-15-2009, 04:18 PM
Mike Halliday Mike Halliday is offline
Senior Member
Join Date: Sep 2007
Location: Warrington, United Kingdom
Posts: 821
Send a message via Skype™ to Mike Halliday
Angry Going APE?

I am playing with the APE functionality for one of my games but have hit a snag.

Loading in the APEDemo.PPL this works fine, so I have tried to duplicate the code in my game as best I can but for some reasone I cant get the sprites to stop when they hit the border of the screen

I do all the APE init stuff;

/* Uses the APE functions library for gravity, inertia and speed */
ape_init(1 / 4);
// massless force applied to Y access only
ape_addmasslessforce(0, 0.3);
cg$ = group_new(true);
ape_borders(cg$, 0.5, 5);

ax$ = Random(8) * 52 ; // Random position across the screen
ay$ = 150;

I load my sprite and set the APE particle;

a$ = loadsprite(AppPath$ + "a.bmp", -1, 1, 0, NULL);

// Create new particle for the APE Engine
sp$ = spriteparticle_new(a$, ax$, ay$, 52, 52, 0, false, 0.01, 0, 0);
group_addparticle(cg$, sp$);
particle_addmasslessforce(SpriteParticle(a$), 0, 3.5)

Have set ape_paint; after render sprites;

Have set ape_step; in WM_TIMER;

When run, my sprite starts at 150 pixels down, then moves on its own down the screen; however, it does not stop when it reaches the screen edges.

I have lines (A box) drawn around the screen, but even removing these from the code still does not stop the sprite when it reaches the bottom of the screen.

The code is almost exactly like the APEDEMO file, except my sprite is not mouse controlled!

What am I doing wrong?

Reply With Quote