The Daily Click ::. Forums ::. Klik Coding Help ::. Shadows for Enemies
 

Post Reply  Post Oekaki 
 

Posted By Message

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
12th July, 2006 at 04:33:54 -

Yeh Phizzy is right

 
This is a signature. Have this one on me.

NeoHunter



Registered
  30/10/2004
Points
  207
12th July, 2006 at 04:50:54 -

I gotta go with Axel on this one, as I'd rather do two lines, then a whole slew of code to get shadows.

Btw this works, and works well enough, as I tested it at work, and even when I gave EVERYTHING a shadow, the game ran fine. The only way this is going to slow things down, is if your computer is a outdated POS.

 
Ohno! The body floats!
-The Teatons

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
12th July, 2006 at 04:59:50 -

Flava, Phizzy: How do you even know that it really DOES slow the game down? Right now you're just assuming so because it's (to you) an awkward way of coding it. At least prove me wrong before jumping to conclusions. o_O

 
n/a

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
12th July, 2006 at 07:03:55 -

No, it's called common sense.
If you want to be unprofessional then fine be lazy and use a two line piece of code. I've just run both programs on my computer and your method uses up more memory. Try it yourself. Okay, it doesn't use up much more memory - but put the rest of your games objects in there and it could prove to be a difference on certain computers.

Your method works fine - if you want a ton of bouncing balls with no animation and no actions at all, then you can use your methods. I'm just saying that spreading values is more efficient, uses less memory and allows the creator/developer to do more things with the objects (such as animating, destroying .etc). And even if it is a few more lines of code - the idea to being a game creator is not to be lazy. If you're lazy, then your game will suck.

I'm just saying - you'll have to add backdrops, scrolling, characters, weapons and all kinds of other things moving at once. And while the player is playing a shadow (which will probably have semi-transparency?) will be created every single split of a second and then destroyed.

Sure, use Axel's method - it probably won't make too much a difference. But please don't be lazy with anything else.

Image Edited by the Author.

 
This is a signature. Have this one on me.

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
12th July, 2006 at 07:14:00 -

It may be a lazy and unproffessional approach, but it's not the end of the world, and it's a lot easier than messing around with spread a value and fastloops, which can be pretty hard unless you know what you're doing.

I'd probably use the spread a value version myself actually, but it's Del Duio's own choice which method he wants to use in his game

 
n/a

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
12th July, 2006 at 07:16:04 -

I'm fairly sure you don't need to use fastloops when using spread values neither.. I can't remember.

 
This is a signature. Have this one on me.

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
12th July, 2006 at 07:18:15 -

Me neither, but it only took 8 lines of code anyway.

http://aggggge.frac.dk/shadowexample.cca

 
n/a

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
12th July, 2006 at 07:52:52 -

So it sounds to me like a spread value basically makes active objects into a single dimensional array. If so, that's just what I want then. Thank you for all of your replies!

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Werbad



Registered
  18/09/2002
Points
  235
12th July, 2006 at 09:43:44 -

* Always
- Shadow set position at enemy
This works fine and people not aware of this are stupid

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
12th July, 2006 at 10:09:49 -

That will only work for a single object. It may kinda-work for several (MMF showing rare intelligence) but the game will get confused before long, and there's no way to manage destructions. So no. That's almost as horrible as Axel's method.

 
n/a

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
12th July, 2006 at 10:13:19 -

Spreading values allows you to somewhat assign a 'unique ID' to each shadow and object.
So a shadow with ID 1 will assign to the object with ID 1 .etc
This way, you can delete both the object and the correct shadow, or change animations of each or whatever.

Basically spreading values lets you do more things and is completely bug free (if you do it correctly)

 
This is a signature. Have this one on me.

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
12th July, 2006 at 13:23:48 -

It's not good because it's overkill.
The game is doing more work than it needs to and thats bad for minimum system requirements.

Anyway all you need to do is


(amount of shadows < amount of enemy) - create shadow at 0,0
(always) - shadow follow enemy.

that works.

 
.

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
12th July, 2006 at 13:33:31 -

See my last post. That does work thanks to some sort of magic, but it can get confused and there's no guaranteed way to manage destructions. I would use either spread values or my original suggestion, depending whether the enemies are already in the frame or are created at runtime.

Keep in mind that just because you can do something in less events doesn't mean that less instructions are required to actually achieve it: I'm not sure exactly what happens when you use that method, but I can imagine it being some complex stuff, each and every frame, to determine which objects aren't paired with a shadow and vise versa, then allocation, then the actual positioning. While on the other hand if alt values are used to find the object focus directly, it's conceivably (and I'd say likely to be) more efficient.

 
n/a

DanielRehn



Registered
  18/09/2002
Points
  139
12th July, 2006 at 14:26:10 -

What Werbad said is correct... works fine! It's simple to manage destructions as well.. when a unit dies, destroy 1 shadow.. when a unit is summoned add 1 shadow...

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
13th July, 2006 at 00:34:19 -

mispost

Image Edited by the Author.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click