Get weapon actor to move up and down
JayReiter
TexasMember Posts: 88
I'm working on a shoot em up. I'm designing a multiple weapons system for the game. One of the weapons, called a Wave beam, I want to go up and down as it scrolls across the screen from the spawn point. I kind of want it to look like a ball going up and down over and over again as it goes across the screen. Any ideas on how to do this? Thanks.
Comments
A wave would need to be a sin function. Read up on those or check out @Socks' recent demos on the Spare Code thread.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Constrain its Y position to:
AAA * sin(self.time * BBB) + CCC
AAA= the height of the wave
BBB= the speed of the up down movement
CCC= the position of the gun
@JayReiter
Here's a quick demo file, up and down arrow keys move the gun, space bar fires.
Link: https://www.mediafire.com/?e1yv7s30ewgb1o2
Thanks to the both of you. @Socks Your demo is great. I haven't quite gotten mine perfect but it definitely works. I seem to be having a hard time with getting the starting point of the blast right. The first time the weapon fires, the beam actor is spawned at the very bottom of the screen, regardless of what the player actor's coordinates are. Then after the first initial blast is spawned, the remaining spawns are more or less tied to the player's coordinates.
Yeah, if you are using a sine wave that is taller than the mouth of the gun then you'd need to start with a shorter sine wave and interpolate it to the height you want the wave to be.
That's what I did with the demo, so that the wave comes out of the end of the gun.
Sounds like your code is set up wrong.
I'm going to post screen shots of my code for you to look at @Socks. Just as soon as I have some free time here.
I'll take a look when you post it.
[]
[]
[]
https://youtube.com/watch?v=BgrQN2MmC0s
Ok. The YouTube link shows what the wave beam is doing. I have two wave beams, one on top, one on bottom. That effect is working great. I just can't seem to get the beam to link properly to the player. Let me know if you need me to grab any more snapshots @Socks
I'd really need to see what's in those expression boxes !
Right. That makes sense. Lol. I'll get on that.
[]
[]
[]
[]
[]
[]
[]
[]
@Socks I think that's everything.
Sorry too much info for me to trawl through !!! I thought it would just be the rules for the problem bullets . . . . : (
Is the first bracket around self.time*700 a square bracket ? . . . [ . . . .
If you up load your project I would be happy to take a look at it, if you don't want me to steal it, then just delete all the stuff you don't need, just leave one or two actors displaying the issue.
The brackets are normal ( and ) brackets.
@Socks This is the conversation that I sent you the game from.