2x2 Robot Enemies
#1
Posted 08 December 2006 - 03:57 PM
Ok, I am now working on the AI. I want to make a 2x2 enemy made entirely out of robots. What would be my best route in coding?
---------
| 1 | 2 |
---------
| 3 | 4 |
---------
Uniquesoft
#2
Posted 08 December 2006 - 04:33 PM

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#3
Posted 08 December 2006 - 05:13 PM
Uniquesoft
#4
Posted 08 December 2006 - 06:19 PM
#5
Posted 08 December 2006 - 06:23 PM
cwags55, on Dec 8 2006, 10:13 AM, said:
you're right it definitely would be easier.
You are greatly underestimating the difficulty of linking robots together into one solid moving block that doesn't just disintegrate. It takes an incredible degree of precision and coding magic to make such an enemy work, just use a sprite.
Go open up some of, oh I dunno talon's tale's bosses and see for your self, and even those weren't perfect.
This post has been edited by KenOhki2112: 08 December 2006 - 06:29 PM
<Cybersilver> "All my sugestions are for FUTER VERSIONS. Say it with me Fu-ter futer. Yep..."
9-21-2009, SFMZX game play video: HERE
Risu2112
#6
Posted 09 December 2006 - 11:07 PM
Quantum P., on Dec 9 2006, 04:19 AM, said:
MZX's collision detection is comprised of a check to see if the sprite would collide with anything (and what it would collide with) if the sprite was at a certain X Y. So, if there's a possibility that the sprite is going fast enough to move through walls when just a single check is being done, multiple checks will be needed.

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#7
Posted 10 December 2006 - 01:15 AM
I was actually pretty surprised that you described MZX's system, people seem to expect/prefer an event based system (like being sent to labels after a collision happens)
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#8
Posted 11 December 2006 - 01:27 AM
Lancer-X, on Dec 8 2006, 11:33 AM, said:
That's what I'm thinking. I quickly avoided using coupled robots once I started poking around with sprites. A group of robots are not as reliable as sprites, plus there's the issue of them breaking apart. A sprite is a complete mass, so making it move, flows fantastically better than a group of robots. Plus: by using sprites you'll use less code and only one robot.
#9
Posted 12 December 2006 - 08:59 PM
Is there a way to lock an overlay to particular robot the same way you can the player. i.e (rel to player)
So like a 'rel to (robotname)' ?
Uniquesoft
#10
Posted 12 December 2006 - 10:22 PM
#11
Posted 12 December 2006 - 10:47 PM
cwags55, on Dec 12 2006, 03:59 PM, said:
Is there a way to lock an overlay to particular robot the same way you can the player. i.e (rel to player)
So like a 'rel to (robotname)' ?
Now's the time to learn. At least read the help file's section on it. Trying anything else would be a serious headache that can be easily avoided.
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#12
Posted 13 December 2006 - 07:08 AM
<Cybersilver> "All my sugestions are for FUTER VERSIONS. Say it with me Fu-ter futer. Yep..."
9-21-2009, SFMZX game play video: HERE
Risu2112
#13
Posted 13 December 2006 - 03:58 PM
Uniquesoft
#14
Posted 13 December 2006 - 05:31 PM
set "spr0_refx" 12 set "spr0_refy" 14 // sprite 0 will reference the image at (12, 14)... set "spr0_width" 5 set "spr0_height" 5 // ...and be 5 by 5 characters in size put c?? sprite p00 at 25 25 // draw sprite 0 at (25, 25), p?? refers to the sprite number set "spr0_x" 30 set "spr0_y" 35 // move him to (30, 35) set "spr0_off" 1 // and later, turn him off
There is, of course, a lot more you can do with them, like sync the overlay to the sprite as if he were the player, or control the order in which sprites are drawn on top of each other or where they're referenced from, etc. Just go read the help file when you can; it's all about counter manipulation.
#15
Posted 13 December 2006 - 06:22 PM
Thanks.
How would you sync a sprite to a robot?
Uniquesoft
#16
Posted 13 December 2006 - 06:57 PM
Edit: If you really wanted to, every time the robot moved, you'd have it set the sprite x and y coordinates to the robot's thisx and thisy.
#17
Posted 14 December 2006 - 03:34 PM
Uniquesoft
#18
Posted 14 December 2006 - 03:46 PM
"Nothing wrong with a little shameless plugging."
..Ignorance is to be unaware of the truth.
....Incompetence is to be unable to grasp the truth.
......And escape is to run away from the truth.
It is useless to run, since the truth is right next to you.
-Wervyn
#19
Posted 14 December 2006 - 04:29 PM
Thanks guys. This will help Hamlet 3s developement cycle for sure.
Uniquesoft
#20
Posted 14 December 2006 - 04:58 PM
basically this means instead of
set "spr0_refx" 12 set "spr0_refy" 14 set "spr0_width" 5 set "spr0_height" 5 put c?? sprite p00 at 25 25
you have
set "spr&robot_id&_refx" 12 set "spr&robot_id&_refy" 14 set "spr&robot_id&_width" 5 set "spr&robot_id&_height" 5 put c?? sprite "robot_id" at 25 25
as long as it's just one sprite per bot, this can make managing sprite numbers easier. just a tip.
<pyro1588> "welcome to australia, can i help you find what you're looking for?"
<Tox> pyro1588, I'm giving you the most reproachful of glares right now.
--------
Go show those nutty Koreans what us crazy Europeans are made of pirate.gif pirate.gif pirate.gif - Saike
<exophase> The old Commodore strategy of, "Go friggin' bankrupt!"
<wervyn> Go away! I'm writing the same engine I always do!
#21
Posted 14 December 2006 - 06:26 PM
So I won't be able to test some of these things untill tonight, but do sprites have similar properties to an overlay?
i.e.
When you place a sprite, does it leave what was underneath it or does it clear it?
Can you use the 'Sprite' code the same way you can use smething like 'Solid', so
if c?? sprite p?? at 1 1 "go"?
Uniquesoft
#22
Posted 14 December 2006 - 08:05 PM
Sprites are also usable in a similar way to other built-in entities like solids or customblocks, and you can use something like that if statement to check for the presence of a sprite. However, if you're interested in collision detection, what you actually want to do is use "if c?? sprite_colliding pNN at x y then label". This will call a collision check based on what would happen if you moved the sprite x by y spaces on the board. You can then use the spr_collisions counter to get the number of collisions that occurred, and the spr_clistN psuedo-array to get the ID of each collision in the list. -1 represents a collision with the background (customblocks only), and any other number represents a sprite id.
It's relatively simple to loop through that list, send any relavent touch messages. With a good robot naming convention, this is pretty simple, just name your robot "spriteN" where N is the sprite ID. If you're using the robot_id trick to reference your sprites, try sticking . "@Sprite&robot_id&" in your robot code to rename it for this purpose. And oh, be sure to abort changing the values to move the sprite, if you don't want to send it through the wall.
"Be sure to drink your Ovaltine!"
..Ignorance is to be unaware of the truth.
....Incompetence is to be unable to grasp the truth.
......And escape is to run away from the truth.
It is useless to run, since the truth is right next to you.
-Wervyn