Lukket

Director Code v11.5 - help needed

Hi, i am in the middle of creating a game for a first year university project. I have had trouble geting a bullet to fire out of a moving sprite which is controlled by the keyboard arrows. Here is the script attached to the moving sprite,

property pMySprite, pSpeed

on beginsprite me

pSpeed = 5

pMySprite = sprite([url removed, login to view])

end

on exitframe

case TRUE of

(keypressed(124)) : [url removed, login to view] = [url removed, login to view] + pSpeed

[url removed, login to view] = 1

(keypressed(123)) : [url removed, login to view] = [url removed, login to view] - pSpeed

[url removed, login to view] = 0

(keypressed(125)) : [url removed, login to view] = [url removed, login to view] + pSpeed

(keypressed(126)) : [url removed, login to view] = [url removed, login to view] - pSpeed

end case

end

The above code simply moves the sprite arround the screen, below is the code ive attached to the bullet...

property pTankShell , pSpeed, pTop, pBottom, pFire

on beginsprite me

pTankShell = sprite([url removed, login to view])

pSpeed = 15

pTop = - 10

pBottom = 610

pFire = false

end

on exitframe me

if keypressed (49) then

Shoot

if [url removed, login to view] > pBottom then

[url removed, login to view] = pTop

pShoot = false

end if

end if

on Shoot

[url removed, login to view] = sprite(3).locv + pSpeed

[url removed, login to view] = sprite(3).loch

end

All this code seems to do is relocate the bullet to the postition of the moving sprite. how could i have the bullet moving down to the bottom of the stage from the position of the moving sprite, then reseting to the top of stage until the key is pressed again.

Any help would be appriceated for this project needs to be in for monday.

thanks very much,

Færdigheder: Actionscript, Adobe Flash

Se mere: how to relocate, how code, first code, fire actionscript, director of, code top, 5/y-5, 5 below, 10-12 code, relocate, loch, game sprite, property code, help creating, 2010 keyboard, keyboard code, director script, director game, top bottom code, actionscript help, university year, trouble shoot, game script needed, game project director, game key

Om arbejdsgiveren:
( 1 bedømmelse ) N.Ireland, United Kingdom

Projekt-ID: #678509