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 / Dummy sprites

Author
Message
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 20th Jul 2012 13:39
Am I doing something wrong or does dummy sprites not show up when using setphysicsdebugon()? How will I know where they are?



lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 20th Jul 2012 13:51
If you are not using virtual resolution your box would be drawn just outside visible screen with normal view zoom and view offset.

Try changing the position of the dummysprite. Also can't remember and can't check right now, is "2" a static physicsobject?

My hovercraft is full of eels
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 20th Jul 2012 14:09
Ah, look at that. I copied the code from my original project. I wonder why it shows up now but not in there. Thanks.

But now I have another problem. According to the dummy sprite description "Dummy sprites will not update their stored angle and position with the latest physics versions" but with Setspritephysicson(ds, 2 ) it falls down. If I use mode 1 or 3 I don't get contacts with other sprites that are also in mode 1 or 3. If I don't activates the physics it won't show up (and probably generates no contacts either).

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jul 2012 14:15
I don't tend to use dummy sprites but I think you'll get the effect you want by using a kinetic or static physics sprite and then use setSpritePhysicsIsSensor command...


this.mess = abs(sin(times#))
lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 20th Jul 2012 14:43
Making a dummy sprite as sensor will register contacts but other objects will not be affected by the sensor dummy.

I use these a lot by weld jointing sensor dummies to detect which surface of an object that has collided.

Anyway, making the dummy static (not sensor) should make it act like a barrier to dynamic physics objects

My hovercraft is full of eels
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 20th Jul 2012 15:30
Thanks a lot Baxslash

I should kick myself in the ass because I didn't read through the whole command set. There's a lot of physics and sprite commands and I didn't know where to look. Now I don't even have to use a dummy sprite, I can just set the player sprite to be a sensor. It's what I've been looking for these last couple of days. I was about to write my own collision detection algorithm. I'm glad I don't have to waste time on that. Maybe I can finally get a playable demo of my game out next week

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jul 2012 15:45
Great, glad to help!


this.mess = abs(sin(times#))
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 20th Jul 2012 19:40
baxslash:
Is there any command to make the sprite not affected by gravity? I have to make it dynamic to register contact against static objects (the level).

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jul 2012 20:41
It shouldn't need to be dynamic to register contact with a static object as far as I am aware but if that's the case perhaps you could set the gravity to zero and apply your own gravity force to the sprites that require it? If there are a lot this could become tiresome and slow however...

Another option is to manually position a sensor sprite where your dynamic sprite is each loop...


this.mess = abs(sin(times#))
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 20th Jul 2012 20:52
I am manually positioning the sprite each frame as it is now because I don't like the built in physics. I might let AppGameKit handle my gravity, we'll see. I just thought it could be useful to know about. But yeah, only dynamic sprites can detect contacts with non dynamic sprites. It's like there should be a fourth type, one that detects contacts but isn't affected by physics at all.

lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 20th Jul 2012 21:18
Wouldn't it be easier to set a force to negate gravity on the dummy instead of simulating gravity on all other objects with force? Just a thought. Not entirely sure whats meant to be achieved, sorry

My hovercraft is full of eels
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 20th Jul 2012 21:33
Sounds like a good idea lilpissywilly

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jul 2012 21:44
Sounds good but it's not stable. I tried it. Try it yourself if you like, just create a sprite in the middle of the screen and try to make it stay still when gravity is on!


this.mess = abs(sin(times#))
lilpissywilly
AGK Developer
13
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 21st Jul 2012 02:54
I kinda figured there was a catch since that was your answer to the problem hehe. Tried it with not allowing rotation?

My hovercraft is full of eels
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st Jul 2012 08:22
Didn't try it with no rotation...


this.mess = abs(sin(times#))
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 21st Jul 2012 10:37
Well, I'm setting the position of the sprite every frame myself so no need to worry about solving my problem. Unless you want the answer yourself

Login to post a reply

Server time is: 2024-05-05 13:55:48
Your offset time is: 2024-05-05 13:55:48