PDA

View Full Version : help with static (non moving) sprites


zehlein
11-02-2006, 11:13 AM
Hi,
today I have a day off !amazed and I decided to devote the time to have a first look at game api. I took the bounce demo for a start, created a turning ball (hey, looks great!) loaded it and it worked fine. Next I wanted to create a second type of sprite ("nail") that should be static in the screen with the balls bouncing off of the nails. SetSpriteCollide(n$, "ball");
SetSpriteId(n$, "nail");
The only way to make it stay where it should was to not set a SpriteMass to it (Iguess I'm missing something here). But unfortunately the balls keep ignoring the nails and going right through them not bouncing off. What's wrong there?

PointOfLight
11-02-2006, 12:44 PM
Did you happen to set the SO_CHECKCOLLIDE option of the sprite? Also, what code are you using to check that a collision actually happened?

zehlein
11-02-2006, 03:40 PM
SO_CHECKCOLLIDE is set, I use no additional code for checking the collision. I thought, just as used in the bounce.ppl demo, PPL does handle this itself?

kornalius
11-02-2006, 03:43 PM
Also don't forget to set the nails SetSpriteCollide(nail$, "ball"); and set the SO_CHECKCOLLIDE on the nail$ too.

zehlein
11-02-2006, 04:03 PM
that is all done. doesn't work any way. There must be something different wrong with the code then!?

PointOfLight
11-02-2006, 04:07 PM
Sorry, Zehlein, it's been quite some time since I've really worked with the GameAPI, and even when I did I was doing things that didn't require a lot of interaction between sprites. I didn't realize that all this cool "automatic" stuff was in there. Just another reason that PPL is such a great PPC game development tool.

zehlein
11-02-2006, 04:13 PM
yes, that "automatic stuff" encouraged me to try out what's in PPL's GameApi. But at the moment there is no progression... :-(

kornalius
11-02-2006, 05:55 PM
Do you do anything on WM_COLLIDE event? The engine will just call the WM_COLLIDE when collision happens. It won't do anything automatic.

kornalius
11-02-2006, 06:06 PM
Send us your code we will look into it.

PointOfLight
11-02-2006, 06:09 PM
I think what zehlein is talking about is the ability to simulate bounce.ppl, where the balls have the appearance of bouncing off of each other, even though there is no code in response to the WM_COLLIDE event.

zehlein
11-02-2006, 06:15 PM
So there we go. The bounce demo I took as a start does perfectly without handling the WM_COLLIDE event but if you add another "type" of sprite you have to do the work by coding it yourself. Just for my understanding: how does it work in bounce and what is the difference for GameApi in my setting?

kornalius
11-02-2006, 06:18 PM
Bounce.ppl uses SO_BOUNCE to simulate bouncing automatically. The SO_OVAL on each ball tells them that they have an oval shape and to bounce accordingly.

zehlein
11-02-2006, 07:00 PM
well, that's exactly what I wanted, the balls bouncing off from the nails... But as you said they won't do it automatically!?

kornalius
11-02-2006, 07:11 PM
If you provide SO_BOUNCE on the balls they should bounce automatically on collide.

Send us you code and pictures.

PointOfLight
11-02-2006, 07:50 PM
Is it possible to have a sprite collide with more than one sprite type?

kornalius
11-02-2006, 08:19 PM
Yes you need to seperate all id's with a , (comma).

SetSpriteCollide(Sprite$, "ENNEMY,BRICK,CLOUD");

zehlein
11-02-2006, 08:29 PM
That's the key! Kornalius, forget the mail it works now (and should be mentioned somewhere in the Help)

kornalius
11-02-2006, 08:50 PM
SetSpriteCollide(s$, "ball,nail");

Yep your soccer balls did have the nail in their collide.

zehlein
11-02-2006, 09:11 PM
*** !lol ***