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 DBPro Corner / simple sprite placement?

Author
Message
aldoro101
9
Years of Service
User Offline
Joined: 27th Apr 2014
Location:
Posted: 14th Jun 2014 23:03
Is there any way to place a sequence of the same sprite in specific locations on the screen like a tile map? I want to know so I can create a simple level layout with one sprite copied over and over to work as simple obstacles. I'd really appreciate it if there was a very simple way to do it without using a ton of code.

Man everybody got aids n' $h1t.
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 15th Jun 2014 22:10
You can use paste sprite, but you'll need your own collision system in that case if you were relying on the sprite collision commands.

aldoro101
9
Years of Service
User Offline
Joined: 27th Apr 2014
Location:
Posted: 16th Jun 2014 03:59
Is there another method that allows me to use the same sprite so I can use the collision commands? I just want to clone the same sprite to different locations on the screen so I can reference multiple sprites that perform the same function with one command.
Is there any way to do that easily?

Man everybody got aids n' $h1t.
TheComet
15
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 16th Jun 2014 13:37
You can make multiple sprites that reference the same image, if that helps.



aldoro101
9
Years of Service
User Offline
Joined: 27th Apr 2014
Location:
Posted: 16th Jun 2014 20:38
Still not what I'm looking for. I want to use the same sprite in different locations. I want to use the same collision code if I run into a sprite that looks and acts the same as another sprite. Basically, I just want to copy the same sprite over and over again so when another sprite makes contact with one of the copies, it will perform a similar action if it ran into another copy of the same sprite.

Man everybody got aids n' $h1t.
Derek Darkly
11
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 17th Jun 2014 00:05 Edited at: 17th Jun 2014 00:06
Quote: " I just want to clone the same sprite to different locations on the screen so I can reference multiple sprites that perform the same function with one command."


I would probably just use CLONE SPRITE inside a FOR/NEXT loop to create them.

To check the collision for all sprites at once you could use SPRITE HIT or SPRITE COLLISION within another FOR/NEXT loop.

I can make some kind of example if you'd like.

666GO†O666
aldoro101
9
Years of Service
User Offline
Joined: 27th Apr 2014
Location:
Posted: 17th Jun 2014 00:15
That would help a lot if you could show me the code.

Man everybody got aids n' $h1t.
TheComet
15
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 17th Jun 2014 11:09
I'd go with what Phaelax said then. Use paste sprite and write your own collision code. Since you said you're using a tilemap, that's very simple to do with two for-loops.



nonZero
11
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 17th Jun 2014 13:26
You can also just use PASTE SPRITE and then SPRITE the one you want closest to the player. Ir would be easier, however I encourage you to rather go with the previous suggestions of your own collision.

The only other alternative is to use ranges so you assign all clones of the sprite 1000 to 2000, say and then check if whar SPRITE COLLISION returns is within that range. If it is, set that variable to the original sprite's number. That way you don't have to change your code much.

But I still agree that own collision is the best option.

[My sig is fixed, links work]
Copy-paste, "I vote for nonZero" into this thread to vote for me. If you don't then shame on you!

Login to post a reply

Server time is: 2023-06-02 22:43:19
Your offset time is: 2023-06-02 22:43:19