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 / create bullet

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 11th Feb 2014 13:42
Hi.
I want make a bullet for my gun. mean I want when press a button create bullet and exit from gun. in Game-editor engine I make a actor (sprite) for each button press, but I don't know how can do it in AGK.

Please Guide Me.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 11th Feb 2014 14:06
If you are using physics do something like the following:


You will need to check for collisions and maybe set the sprite up as a physics sensor rather than just a plain physics object but this is a pretty good start.

Hope it helps!

oct(31) = dec(25)
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 11th Feb 2014 22:35
Thanks baxslash.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 11th Feb 2014 22:46
I wrote this code and I want when GetVirtualButtonState( 1 ) = 1 increase Velocity# and when release it, Fire my bullet but don't work good and physics have problem.



please guide me.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 12th Feb 2014 18:01
It's quite hard to tell from that code. Can you share more? Preferably something I can test run?

oct(31) = dec(25)
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 12th Feb 2014 21:47 Edited at: 12th Feb 2014 21:53
Quote: "
It's quite hard to tell from that code. Can you share more? Preferably something I can test run?
"


Sure.
another Problem is that the bullet slowly move down after run the game.

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 13th Feb 2014 09:00
Looks like you are using a dynamic physics sprite (SetSpritePhysicsOn(spr4, 2)) which is affected by gravity. I have changed this to a kinematic sprite (SetSpritePhysicsOn(spr4, 3)) and increased the maximum velocity.


oct(31) = dec(25)
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 13th Feb 2014 09:48 Edited at: 13th Feb 2014 10:14
thanks
but if SetSpritePhysicsOn(spr4, 3)after collide with wall, out of Vision. and if SetSpritePhysicsOn(spr4, 2)after collide with wall,Stick to the wall.

I want ball have Physics to wall.

Login to post a reply

Server time is: 2024-11-25 01:50:24
Your offset time is: 2024-11-25 01:50:24