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.

Newcomers AppGameKit Corner / Transparent Image as Sprite to Use as Level graphics

Author
Message
Kai Ralfs
4
Years of Service
User Offline
Joined: 19th Jan 2015
Location:
Posted: 19th Jan 2015 10:31
Hi There,
i have an Question about Sprites.
I would use an Image for Levelgraphics so my Player Sprite (with Physic on) can use this as Obstacle.
As Sprite it does not function. Must i draw the Level Sprite by Sprite to have Obstacles?

Greetings
Kai

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
12
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 19th Jan 2015 13:48
You should be able to create a sprite, turn physics on for that sprite and then set its shape. I'm not quite sure what your question is (sorry), can you explain in a little more detail and perhaps give an example of what you are trying to achieve?


Using AppGameKit V2 Tier 1
Kai Ralfs
4
Years of Service
User Offline
Joined: 19th Jan 2015
Location:
Posted: 19th Jan 2015 15:12 Edited at: 19th Jan 2015 15:29
I try ... but my english is not sooo good.

also ... i have an Image . This is my Level Image with Transparent background.
Than i have an Image for the Player
i want that the PlayerBall move over the Level Image. That is no Problem.
But ... When i Set LevelImage for Physics on and PlayerBall too ... the Playball ist not seen.
Do u know what i mean?
My Question is now can i have an Levelimage with bounderies/Obstacles where the Playerball can not move throug?
Or must i make the Level sprite by sprite for Obstacles?

I hope that was a little bit clearer ...

Greetings
Kai

Attachments

Login to view attachments
BatVink
Moderator
16
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Jan 2015 15:32 Edited at: 19th Jan 2015 15:33
I'll add my answer from your other thread here:

You won't be able to use one image as a physics-enabled level. You could still use it and add transparent sprites as static physics objects over the top.

It's a nice idea - a well-drawn background with invisible physics sprites. The disadvantage though is that you can't reuse your drawn platforms etc throughout the game.

I have borrowed a picture to demonstrate. Here, the picture is one background image with NO PHYSICS. Next, I have drawn boxes where you would need to put static physics boxes where the platforms and obstacles are, to create your physics world. BUT it is much better to create your background from separate objects.



Quidquid latine dictum sit, altum sonatur

Attachments

Login to view attachments
Kai Ralfs
4
Years of Service
User Offline
Joined: 19th Jan 2015
Location:
Posted: 19th Jan 2015 15:55
ahhh ... that is not the Answer that i have expected but is a very good answer.
Thanks very much.
baxslash
Valued Member
Bronze Codemaster
12
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st Jan 2015 09:04
Actually it is possible to use a single image and add many physics shapes to your single sprite but it isn't the easiest method or the best way to use resources as BatVink says.


Using AppGameKit V2 Tier 1
BatVink
Moderator
16
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 22nd Jan 2015 11:47
Quote: "Actually it is possible to use a single image and add many physics shapes to your single sprite"


Of course, my very bad! I never thought about having disparate shapes on the sprite. I've always used multiples to form a more complex solid.

Quidquid latine dictum sit, altum sonatur
baxslash
Valued Member
Bronze Codemaster
12
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th Jan 2015 18:33
Me too but i suddenly thought of a number of ways this might be useful for the right game (such as a pinball machine game)


Using AppGameKit V2 Tier 1
Conjured Entertainment
AGK Developer
13
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 28th Jan 2015 11:34 Edited at: 28th Jan 2015 12:01
Quote: " i suddenly thought of a number of ways this might be useful for the right game (such as a pinball machine game)"

HUH? WHAT? Where?
Did someone say Pinball??

Quote: "Actually it is possible to use a single image and add many physics shapes to your single sprite..."

Well, are you going to tell him how, or just tease him???

I would tell him how, but I used basic methods (as above) for my Pinball WIP. (setting bumpers to a circle shape of course, not square)
I would love to see more Virtual Pinball Machines made with AppGameKit!
As well as other retro non-electrical and mechanical electronic games, like the one he is working on.
It looks like those little boxes that had a ball in it and you had to roll through the maze avoiding all of the traps (holes) to win.
Gyroscope and a steady hand would come into play here.


Coding things my way since 1981 -- Currently using AppGameKit V1 Tier 1
baxslash
Valued Member
Bronze Codemaster
12
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Jan 2015 11:54
Quote: "Well, are you going to tell him how, or just tease him???"

Well using the SetSpriteShape... and AddSpriteShape... commands you can add circles, boxes and convex polygon shapes to any sprite. As many as you like.

I could write a great long example but I honestly don't have the time, I would just suggest that if anyone wanted to have a go at doing it that way they should look at the help files for sprites.

The first shape should be made using SetSpriteShape... (where "..." is Circle, Box or Polygon) and the rest using AddSpriteShape...

Remember also that your sprite needs to have SetSpritePhysicsOn for this to work too


Using AppGameKit V2 Tier 1
Conjured Entertainment
AGK Developer
13
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 28th Jan 2015 12:03
Quote: "Well using the SetSpriteShape... and AddSpriteShape... commands you can add circles, boxes and convex polygon shapes to any sprite. As many as you like."

having trouble wrapping my head around the physics involved for the AddSpriteShape(), so I have been avoiding that in fear of running into trouble.
Guess I better start experimenting with it, in case I am missing out on a major improvement.

Thanks


Coding things my way since 1981 -- Currently using AppGameKit V1 Tier 1

Login to post a reply

Server time is: 2019-06-20 16:01:23
Your offset time is: 2019-06-20 16:01:23