Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Player moving the enemy

Author
Message
Kobaltic
12
Years of Service
User Offline
Joined: 24th Jan 2012
Location: PA, USA
Posted: 9th Jan 2014 02:49
When the player collides with my enemy the enemy moves. I tried to turn off collision with setSpriteCollideBit but it didn't work. I set the player to collide bit 3 and not to collide with 4. I set the enemy to collide bit 4 and not to collide with 3. Thanks for the help. Here is some code:

player:


Here is the enemy:
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 9th Jan 2014 09:32 Edited at: 9th Jan 2014 09:35
I set all my enemies up as sensors (SetSpritePhysicsIsSensor()). Alternatively I believe SetSpriteGroup may work too...

EDIT: Here's an extract from the SetSpriteGroup documentation:

In physics, sprites of the same positive group ID will always collide, whilst those that share the same negative group ID will never collide. Those with a group ID of zero (default), or differing group IDs move on to the category filter check.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 9th Jan 2014 15:45
Try moving "setSpriteCollideBit(gtwS,3, 0)" to after "setSpritePhysicsCanRotate(gtwS,0)". Sometimes physics attribute setting can wipe out other settings.

And, as Funnell7 suggests, try setting the collide bit to the same negative value.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Kobaltic
12
Years of Service
User Offline
Joined: 24th Jan 2012
Location: PA, USA
Posted: 11th Jan 2014 01:59
ok so I tried everything and nothing worked. If I use the getSpriteFirstContact on the player everything shows contact. If I use it on the enemy, I get a 1 on static objects but a 0 on dynamic objects. Will look into it more.
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 11th Jan 2014 10:08
Did you try SetSpritePhysicsIsSensor() for the enemies? This will prevent your character from interacting with them, but will still pick up on collisions etc.
Kobaltic
12
Years of Service
User Offline
Joined: 24th Jan 2012
Location: PA, USA
Posted: 12th Jan 2014 02:01
Yes I tried physics sensor.I get no collisions at all even when I check firstContact.
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 12th Jan 2014 09:47
That's interesting, I've not experienced that... But then to be fair, I don't use FirstContact, I use the GetSpriteCollision command. Does this simple project work for you?

Kobaltic
12
Years of Service
User Offline
Joined: 24th Jan 2012
Location: PA, USA
Posted: 19th Jan 2014 03:40
Ok so after a bunch of experiments here is what I have found out. A contact of collision only happens if at least one sprite is dynamic. Any sprite that is dynamic can be moved by another sprite.

I need to find a why to stop a dynamic sprite from moving.

Login to post a reply

Server time is: 2024-11-25 03:00:42
Your offset time is: 2024-11-25 03:00:42