Having some trouble

Non-platform specific questions.

Having some trouble

Postby Archj » Sat Nov 13, 2010 7:51 pm

Hi! I'm new here and I started using Game Editor some days ago. I'm trying to make a very short game demo for a class in school, it's going to be a sidescroller inspired by Mega Man using 8-bit graphics.

I followed Tutochau's tutorial on velocity jumps first, and got that working, then I followed episode two of his video tutorials. So then I had animations for walking left/right and jumping left/right. Then I changed some numbers in the jumping code until I was satisfied. But now I have a major issue, my character only jumps whenever he feels like it, it's like 50/50 chance of doing a jump, and I have no idea why. That's my main concern at this point :(.

I also have some minor questions about animations. Right now my character only have the jumping animation when I hold the jump button, and if I'm jumping without moving it doesn't change at all. I'm not sure how to implement this, is it a good idea to use state variables?

I hope this isn't too much. I would just be happy if someone could point me in the right direction :)
Archj
 
Posts: 8
Joined: Sat Nov 13, 2010 7:38 pm
Score: 0 Give a positive score

Re: Having some trouble

Postby skydereign » Sat Nov 13, 2010 7:59 pm

Well I haven't actually watched those videos, so if you used that code I don't know what he did, but here's an example of a working state system. If you could post the code or a ged, that usually makes it easier for anyone that is trying to help you.
Attachments
moonwalk.zip
(52.61 KiB) Downloaded 268 times
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Having some trouble

Postby Archj » Sun Nov 14, 2010 4:48 pm

Thanks for posting that file, it helped a lot! I messed around with the code for a while and now it's working much better. The code in that .ged was so much better organized than mine, so I think I'll stick to that style hehe.

Thanks for the help!
Archj
 
Posts: 8
Joined: Sat Nov 13, 2010 7:38 pm
Score: 0 Give a positive score

Postby Archj » Mon Nov 15, 2010 9:00 pm

Hello again, I can't seem to fix a bug that occurs when I'm firing, so I'm hoping someone can help me out :)

I create the bullet actor when I press X, and if it's out of vision I destroy it. But if I shoot, and turn around before the bullet is out of vision, the bullet changes direction and comes back :p Here's the code I currently have in the Draw Actor Event:

Code: Select all
switch (STATE)
{
    case 0:
       xvelocity = 20;
        break;
 
    case 1:
        xvelocity = -20;
        break;
 
    case 2:
        xvelocity = 20;
        break;
 
    case 3:
        xvelocity = -20;
        break;
 
    case 4:
        xvelocity = 20;
        break;
 
    case 5:
        xvelocity = -20;
        break;
 
    case 6:
        xvelocity = 20;
        break;
 
    case 7:
        xvelocity = -20;
        break;
 
}


The different states are for jumping/standing/walking to the left/right. I'm just confused at this point :(

I got a question too, btw! Since I'm making a NES-like game, I'm planning to use the resolution 256x228 which is what the NES used. But I noticed that when you change the game resolution you also change the view area? Is there any way to differ between those? It would be nice to have a bigger window while keeping the real resolution... I didn't explain that very well, but hopefully you got the idea.

Sorry if I'm being stupid :mrgreen: !
Archj
 
Posts: 8
Joined: Sat Nov 13, 2010 7:38 pm
Score: 0 Give a positive score

Re: Having some trouble

Postby DarkParadox » Mon Nov 15, 2010 9:35 pm

But if I shoot, and turn around before the bullet is out of vision, the bullet changes direction and comes back

Move the code to the bullets create Actor event instead (that way direction is only set when the bullet is created, and not every frame Image).

I'm planning to use the resolution 256x228 which is what the NES used. But I noticed that when you change the game resolution you also change the view area? Is there any way to differ between those? It would be nice to have a bigger window while keeping the real resolution


The only way would be to set the game to Full Screen... but I doubt you want that. So at the moment, theres no way for the resolution to differ from the view size. Image
User avatar
DarkParadox
 
Posts: 457
Joined: Mon Jan 08, 2007 11:32 pm
Location: USA, Florida.
Score: 84 Give a positive score

Re: Having some trouble

Postby skydereign » Mon Nov 15, 2010 11:06 pm

Just so you know, the state values in the demo I posted are set up so that odd values of state face the left, and even face the right. You can use this instead of a switch covering all states, or do this (just better coding convention).
Code: Select all
    switch (STATE)
    {
        case 0:
        case 2:
        case 4:
        case 6:
           xvelocity = 20;
            break;

        case 1:
        case 3:
        case 5:
        case 7:
            xvelocity = -20;
            break;
    }


For the resolution, you can create a black border, but that's about it.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Postby Archj » Tue Nov 16, 2010 4:59 pm

Works super now! I guess I should read up some more about the different events since I didn't know about that hehe.
And I can't believe I haven't thought of doing that thing with the switch, it's real clever ^_^

As for the resolution, I guess I can stretch out the sprites to double their size, that should work :D

Again, thanks a lot for the help!
Archj
 
Posts: 8
Joined: Sat Nov 13, 2010 7:38 pm
Score: 0 Give a positive score

Postby Archj » Fri Nov 19, 2010 9:05 pm

Hello again! I've made a lot of progress lately, I've almost made a full level, added some enemies that actually works and sounds/music :D

But anyway I have a few questions now, first about the view. I added wire regions to the left and right of my main character to move the view actor, works great. At some part in the level I want to move the view down a full screen (456 pixels), but I can't figure out how to do it. I tried mostly everything I can think of, the closest I came was using a canvas and the "move to" event, but it seemed too complicated to be effective but I don't know. Any tips?

I also can't get the background music to stop when I die (it overlaps with the death music). I searched for it and found something called "soundStop" and something similar, but neither appeared to work.

As always, thanks for helping :)
Archj
 
Posts: 8
Joined: Sat Nov 13, 2010 7:38 pm
Score: 0 Give a positive score

Re: Having some trouble

Postby skydereign » Fri Nov 19, 2010 11:27 pm

You can move the view like this.
Code: Select all
view.y+=view.height;

This moves the view down an entire screen.

As for stopping sounds/music, you need to pass stopSound the proper channel. Assuming you have more than one sound going, and you can't guarantee that the music is playing on channel 1, you can set an int to record the background music's channel. Then pass that to your stop sound. The PlayMusic function will return the channel the music is playing on.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Postby Archj » Sat Nov 20, 2010 5:41 pm

Awesome, it works great! Thanks! I just have one more question... Is it possible to have the enemy actors created only when the view actor "collides" with them? It's not a big deal really, but it would be fun to implement ^_^
Archj
 
Posts: 8
Joined: Sat Nov 13, 2010 7:38 pm
Score: 0 Give a positive score

Re: Having some trouble

Postby skydereign » Sat Nov 20, 2010 11:25 pm

If you mean have it only appear when they come on screen, you can't do that normally. You can create spawner type actors, that when they go on screen they create the enemy actors, and/or use activation regions. They are kind of what you want, but do have some setbacks. Any actor within an activation region is not created until the activation region it is in is within the view. So, when the view "collides" with the region, all actors within the region are loaded.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Postby Archj » Thu Nov 25, 2010 7:03 pm

Hey I'm back, my level is practically complete now, I just need to add some paths to the level boss, wohoo! :D

However I've ran into some problems with an enemy I made. The enemy is going to stand still, fire 4 projectiles in my x direction, pause for 2600ms and then repeat. The mechanism is actually working fine, the problem is that the projectile sound is being played even though I can't see the enemy.

I'm using the same technique with another enemy that fires every 800ms against my current position, no problems there. In Create Actor, I create a timer (periodically 800ms) for the event actor. Then in the timer event for that timer I create the bullet actor which fires in my direction and makes a sound.
Now in the bugged enemy, I do almost the same thing. In Create Actor, I create a timer (periodically 2600ms) which is the pause so to speak. In the timer event for that timer I create another timer (400ms, 4 times), and for THAT timer I create the bullet actor.

I realize this may have come out a little messy lol... but yeah, I don't understand what I have done wrong.
If what I explained is confusing or is not sufficient, I'll upload the .ged-file instead!

Oh by the way, animations. I keep my main actors sprites in a single file, and I've been noticing it's a little bit glitchy (not much), which did not happen with the old sprites I used. I've tried to use different spacing between the sprites, but I can't seem to get it completely right. All the sprites have the same resolution (42x48) too. Any thoughts on this would be appreciated =)
Archj
 
Posts: 8
Joined: Sat Nov 13, 2010 7:38 pm
Score: 0 Give a positive score

Re: Having some trouble

Postby skydereign » Thu Nov 25, 2010 8:12 pm

So the problem is that the actor is creating a sound when it shouldn't? If so in the timer event, for when the enemy fires, check if the actor is within view, and if so play the shooting sound. If this isn't the only problem, than either the ged or a different explanation would help.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Postby Archj » Fri Nov 26, 2010 2:48 pm

Yeah that's basically the problem, even though it doesn't happen with the other enemy using the same code. My only guess is that it's because of the extra timer...

Is there any easy way to check if it's in vision? There's no event for it, and I couldn't find anything in the script reference. Do I have to code my own function for it?
Archj
 
Posts: 8
Joined: Sat Nov 13, 2010 7:38 pm
Score: 0 Give a positive score

Re: Having some trouble

Postby skydereign » Sat Nov 27, 2010 1:03 am

There isn't any way, except checking x and y variables. You can make a function for it if you want, its easy enough to do.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest