Computer Science Canada mario game help needed |
Author: | new [ Sat Dec 18, 2004 3:50 am ] |
Post subject: | mario game help needed |
this is my final asisnment..i'm trying to make a mario demo kinda game.. i just strated like yesterday...faced soo many problems 1) scrolling the map left and right 2) problems with ai note: this is not completed....the yellow box is just like ma test..i'll have a mario pic and same witht the ai some one plzz help me with this...mainly with scroling and ai..... |
Author: | new [ Sun Dec 19, 2004 12:09 am ] |
Post subject: | |
yo guys...u probably noticed the jump with gravity thread on the forum..it is for this game as well.....i some wat figured it out...but i nedd help in scroling the map and ai...plzz help i want to make a game like this http://ww.smashits.com/games/g_frames.cfm?File=superm/tgf0001.html or go here and click super m http://ww.smashits.com/index.cfm?Page=Games |
Author: | Neo [ Sun Dec 19, 2004 1:50 am ] | ||
Post subject: | |||
To scroll, you basically give x and y coords to the objects you want to scroll. When the player reaches the right side of the screen you want to decrease the x coords so taht the objects scroll to the left and vise-versa for when the player is on the left edge of the screen. Drawing the background on an jpg or bmp image and then scrolling the whole image isnt very efficeint. Heres some example code.
Of course, in your game you wouldnt draw the blocks randomly. Instead you give them specific coordinates but you should get the idea from this example. To make it more efficient, dont draw the blocks if they are <0 or >maxx. |
Author: | new [ Sun Dec 19, 2004 9:50 am ] |
Post subject: | |
here you are randomly creating the boxes....and movieng them left or right accoring to the palce where the oval is....but i can do tat....coz...i'have to make ai's moving based on these blcks..if i randomized.....i dont think..i can make ai's....is there any other way.?? plz help..thx in advance |
Author: | Cervantes [ Sun Dec 19, 2004 10:02 am ] |
Post subject: | |
new wrote: i'have to make ai's moving based on these blcks..if i randomized.....i dont think..i can make ai's....is there any other way.??
Neo wrote: Of course, in your game you wouldnt draw the blocks randomly. Instead you give them specific coordinates but you should get the idea from this example.
Don't draw the blocks randomly. Besides, Mario AI isn't really AI. It's more along the lines of making an object repeat a task (such as moving forward and jumping every 3.5 seconds) over and over again. |
Author: | new [ Mon Dec 20, 2004 3:20 am ] |
Post subject: | |
this is ma updated code..for the mario setscreen ("graphics:400;300,offscreenonly") const gravity := 0.1 const Friction := 0.99 var x, y, vy, vx : real x := maxx / 2 y := 10 vx := 0 var jumping := false var keys : array char of boolean loop Input.KeyDown (keys) if keys (KEY_UP_ARROW) and ~jumping then jumping := true vy := 5 end if if ~jumping then if keys (KEY_RIGHT_ARROW) then vx += 0.1 end if if keys (KEY_LEFT_ARROW) then vx -= 0.1 end if end if if jumping then vy -= gravity y += vy end if if y < 10 then y := 10 jumping := false end if x += vx if ~jumping then vx *= Friction end if cls drawfilloval (round (x), round (y), 10, 10, black) View.Update delay (5) end loop use this and the pics in the dowload above.... i'm planing to use wat do colour for collisoion detection....but it deosnt work though..so..if tat guy jumps under a block...he sud not go over the block..but he sud..hit it and fall down as well...i tried teh wat dot colour..it doesnt seem to work though....any tips? |
Author: | Cervantes [ Mon Dec 20, 2004 9:14 am ] |
Post subject: | |
Wait a minute... I recognize that code! I hope, for your sake, you just pasted the wrong thing. Anyways, tips for whatdotcolour collision. Read the whole thing: I think I explained it fairly well |
Author: | MihaiG [ Mon Dec 20, 2004 2:06 pm ] |
Post subject: | |
he he he somehow the same codesame variable names... |
Author: | Carino [ Mon Dec 20, 2004 4:39 pm ] |
Post subject: | |
The scrolling is pretty simple. Once the guy gets to certain point on the screen u scubtract or add to a variable, such as the x-position or w/e. This should scroll the background, and ofcourse, when hes at this position, don't add to the guys x position or else he will go off screen. AI is simple for this game, just use collision detection if u want. Once the guy hits a wall/block/w.e he goes in the opposite direction. Its simple. Think about it logically and linearly. |
Author: | MihaiG [ Mon Dec 20, 2004 5:19 pm ] |
Post subject: | |
try working it out on a sheet of paper pseudo code... like think what happens whne he oes near a wall? he stops... so make a boudrie.... trust me pseudo code helps |
Author: | new [ Tue Dec 21, 2004 12:49 am ] |
Post subject: | |
i did make the ai move the other way when it hits the wall using whatdot colour..the problem is tat the ai has to be inside teh screen tat we see..or else it wont collide..it just keeps going.... man..so many problems in this game carino...made a similar game...i need his help desperately |
Author: | Cervantes [ Tue Dec 21, 2004 7:20 am ] |
Post subject: | |
for AI, don't use whatdotcolour collision detection. For your character, it could be a good idea, if done right. |
Author: | Carino [ Tue Dec 21, 2004 12:05 pm ] |
Post subject: | |
I didn't use whatdotcolour for the collision, i personally don't like it. I just used the box-style collision detection. It involves a lot of long if statements but it works well and accurately. |
Author: | Cervantes [ Tue Dec 21, 2004 3:03 pm ] |
Post subject: | |
Sure it works, but it's quite annoying to have to make THAT many if statements. Your main character must interact with everything (or most things) in the environment. This is why it's a good idea to use whatdotcolour collision detection for the main character. Plus, it's entirely feasible because the main character is always "on screen". For the enemies (who will probably be performing a set routine that has nothing to do with the status of your main character) should use if statements. The enemies don't even have to interact with their environment, they can just "happen" to turn around and walk in the other direction when they reach a wall. So, all you must do is use a little if statement to determine the location of the enemy and then reverse the direction, or do what you want to do. Actually, you don't even have to perform any of these ifstatements until the enemy comes within sight of your main character. Just have a flag (a boolean variable) to signify whether the enemy is about to come onto the screen or if he has in the past (make the flag = true if the previous statement is true). If the flag is true, begin the if statement "AI". I wonder if that's actually how Mario works, or if they had the AI working non-stop... |
Author: | new [ Thu Dec 23, 2004 10:06 pm ] |
Post subject: | |
u,,...thx wat abt teh jump on teh blocks...when i jump under a block...how to make the guy not continue with teh jump...but make him go down.... |