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 / Alien Movement prob

Author
Message
GameMaker Jason
20
Years of Service
User Offline
Joined: 22nd Nov 2003
Location: UK
Posted: 16th May 2004 21:58
I have been tring to make my alien move right then when the right hand alien hits the edge of the screen they start going in the opposite direction until the left hand lien hit the side etc.
This is my source


Could someone tell me what i am doing wrong?
thanx

GameMaker Jason
20
Years of Service
User Offline
Joined: 22nd Nov 2003
Location: UK
Posted: 18th May 2004 21:00
I've have done the alein movement but have been tring to make the aliens disapear when the bullet hits them but i get an error say that prite does not exist what is wrong with this code?



thanx to anyone who helps

Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 19th May 2004 01:45
Hi,

The message is right, you haven't created Sprite 2 anywhere.

As a sanity check, add this before your main do loop...



Look at number 2...not there! Remove my code, and add "sprite 2,0,0,1" before you do loop, run the program and it works. Well, the firing needs sorted out, but a bullet fires and zaps through a line of invaders.

Hope it helps,
Cheers.
GameMaker Jason
20
Years of Service
User Offline
Joined: 22nd Nov 2003
Location: UK
Posted: 19th May 2004 20:08
I'm trying to use the stary background tut(memblocks) that TGC have on there site but i don't see stars at the bottom of the screen.

Here's my code:



if you need to compile it i'll send you the media.
Thanx

Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 19th May 2004 21:58
Hi,

Dont worry about the media, I just replace your image load with an image grab of a box

So, anyway, it worked fine for me, I could see a ton of scrolling stars, not sure what the problem-o is at your side. I've attached a snap -



- does that look about right?

p.s. looks good so far, I could also shoot and zap the invaders.

Cheers.
GameMaker Jason
20
Years of Service
User Offline
Joined: 22nd Nov 2003
Location: UK
Posted: 19th May 2004 23:07 Edited at: 19th May 2004 23:24
Do you think that i run out of ram? how much do you have?
My game has also slowed by nearly 3 times.

have's My Shot:



Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 20th May 2004 00:24
Hi,

Not all of the image downloaded for me so I can't see the bottom of the screen!

I have 256mb ram btw, I did see a weird memblock issue once where it only worked correctly in full screen exclusive, so you may want to try some different modes.

To be honest, you may want to just use paste image instead... paste image is fast.

Cheers.
GameMaker Jason
20
Years of Service
User Offline
Joined: 22nd Nov 2003
Location: UK
Posted: 20th May 2004 20:50
I'm tring to make my aliens reappear once they are all destroyed but it doesn't work properally i've tried multiple thing's
heres my latest:



thanx

Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 21st May 2004 12:42
Hi,

I'm not at my DBP machine today, but I'll try to check this out later tonight for ya.

Cheers.
Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 22nd May 2004 16:14
Hi,

Sorry for the delay, I ended up leave working late last night. Ok, so I think its a logic problem where you try to make all the sprites visible again, but you had "and enemiesleft=0" in the for loop, so it was getting in a tangle.

To debug it, I added some quick code to the top to fake destroying 29 enemies in a single key press, save you killing 'em all each time (as fun at this is!), and from there I monitored the value of enemiesleft, and saw that when you had killed them all, it was set to 29, this releaved the logic error.

So, what I've done is make a spawnenemy subroutine, and when enemiesleft reaches zero, we respawn (coz this does positions 'em back where they below), re-show the sprites, and set enemiesleft back to 30. I also use that subrouting for the initial creation of the enemies.

I've commented the code (quickly!), left in my "down to 1 enemy" debug, and coz I don't have your media I quickly used boxes again instead. p.s. I commented out the sound also as I don't have the wavs.

Here ya go...



Hope it helps...
Cheers,
GameMaker Jason
20
Years of Service
User Offline
Joined: 22nd Nov 2003
Location: UK
Posted: 23rd May 2004 01:44
I am not shure how to make my aliens shoot a bullet down to wards you when there is no aliens below them. how could i do this.



Thanx

Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 23rd May 2004 16:25
Hi,

I can't remember, but in the original invaders did they only shoot if nothing was beneath them? Perhaps they shot whenever they liked and thier bullet collision was only detected against the player, not the other enemies, that would certainly be easier to implement

If not, you could try placing a dummy sprite down the indented path, and if it doesn't hit any other enemy, the path is clear, so fire a bullet. It would be quicker to have a single sprite object, that is quite long, and place that at an offset from the invader in question, that would save moving a sprite down the bullet path.

Pseudo...

for a=1 to enemies
place test sprite at enemy position
offset test sprite on y by 1/2 of its length
for b=1 to enemies
did test sprite collide with any other enemy?
if so...
enemy(b).path=not clear
else
enemy(b).path=clear
next b
if enemy(b).path=clear
enemy(b).canfire=yes
else
enemy(b).canfire=no
endif
next a

That's not tested btw, its just a theory

Another idea may be to store the enemies and their states in an array, then you could check the state of the enemy below the one that is about to fire, e.g. if the enemy below state is "killed" then the path is free. Just an idea though... I prefer the test sprite idea personally.

Cheers.
GameMaker Jason
20
Years of Service
User Offline
Joined: 22nd Nov 2003
Location: UK
Posted: 24th May 2004 20:42
How can i make the test sprite thing. i'm unshore of it



Thanx

Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 25th May 2004 11:56
Hi,

It would just be a normal sprite, but hidden (you may want to leave it visible while you implement it though, it'll be easier to see what is going on). As with most things, probably best to break this down into smaller chunks, and work on them one by one, say...

1) Create test sprite, e.g.
box 0,0,8,640
get image 999,0,0,8,640
sprite 999,0,0,999

2) Create a loop to position the test sprite at the live alien coords

3) An an offset so the test image is displayed as if it were a ray casting downwards (its just a sprite collision check down the path that a potential bullet would follow).

4) Add the collision check

5) Add collision response behaviour

6) Hide the test sprite

Hope it helps, sorry I can't drop you any code, v-busy with work and study this week

Cheers.
GameMaker Jason
20
Years of Service
User Offline
Joined: 22nd Nov 2003
Location: UK
Posted: 26th May 2004 20:25
I am now tring to make make alien shot when the timer reaches 0 then reset it to a random time between 2-10 seconds but i dont know how to make my variable count down 1 everysecond.



Thanx

Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 28th May 2004 14:12 Edited at: 28th May 2004 14:13
Hi,

IanM uploaded a snippet to the Codebase for doing count down timers, it may help you out -

http://www.thegamecreators.com/?m=codebase_view&i=c6125a943ea8979ee926dddfe2122168

If not, let me know, good luck!
Cheers.
GameMaker Jason
20
Years of Service
User Offline
Joined: 22nd Nov 2003
Location: UK
Posted: 29th May 2004 12:10
i think i understnad how it work but im unshore of who i would implimate this in my game so that there is 10 seperate counter that both have a random value so there is no pattern in the shooting of the alien.

Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 1st Jun 2004 13:40
Hi,

You could do something like this...(pseudo)

1. Pick a random alien
2. Pick a random number (used for "alien fire" probability)
3. If random alien isn't firing and random number is a certain value, make that alien fire

e.g.

alien_number=rnd(max_aliens)
alien_prob=rnd(10)
if alien_data(alien_number).state=not_firing and alien_prob=1
do_alien_fire
endif

This picks a random alien, and gives them a random chance to fire, if they are not firing already, weighed to 10.

Something along those lines.

I think you'll find it easier if you set up an array for all aliens, and keep a state for them etc.

Hope it helps,
Cheers.
Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 9th Jun 2004 20:30
Hi,

Any update with your Space Invaders project?

Cheers.

Login to post a reply

Server time is: 2024-09-22 12:43:16
Your offset time is: 2024-09-22 12:43:16